0
0
mirror of https://github.com/TrianguloY/UrlChecker.git synced 2024-09-19 20:02:16 +02:00

Create latest action for dynamic files

Currently builds a shilds.json file with the latest version based on the gradle file
This commit is contained in:
TrianguloY 2022-09-04 12:11:57 +02:00 committed by GitHub
parent 1a19ba6584
commit 963c5118a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

43
.github/workflows/latest.yml vendored Normal file
View File

@ -0,0 +1,43 @@
name: Update dynamic files
# When pushing to the master branch
on:
push:
branches:
- master
# parameters
env:
TAG: latest
SHIELDS: shields.json
# Workflow in ubuntu
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Get the repository files
uses: actions/checkout@v3
- name: Create ${{ env.SHIELDS }} file
run: |
cat <<EOF | tee ${{ env.SHIELDS }}
{
"version": "v$(sed -ne "s/ *versionName \+['\"]\([^'\"]*\)['\"]/\1/p" app/build.gradle)"
}
EOF
- name: Update ${{ env.TAG }} tag to current commit
# equivalent to EndBug/latest-tag@latest but simpler
run: |
git tag --force ${{ env.TAG }}
git push --force origin tag ${{ env.TAG }}
- name: Upload files to ${{ env.TAG }} release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.TAG }}
files: |
${{ env.SHIELDS }}