Skip to content

Commit

Permalink
generate release when a new tag is pushed
Browse files Browse the repository at this point in the history
resolves #290
  • Loading branch information
TrianguloY committed Aug 28, 2024
1 parent 87754cf commit 9f5720c
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ jobs:
run: zip -j -P ${{ secrets.ALPHA_PASS }} ${{ env.ZIP }} app/build/outputs/apk/${{ env.VARIANT }}/app-${{ env.VARIANT }}.apk

- 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 ${{ env.ZIP }} to ${{ env.TAG }} release
# equivalent to softprops/action-gh-release@v1 but using official cli
run: |
gh release upload ${{ env.TAG }} ${{ env.ZIP }} --clobber
env:
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ jobs:
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 ${{ env.SHIELDS }} to ${{ env.TAG }} release
# equivalent to softprops/action-gh-release@v1 but using official cli
run: |
gh release upload ${{ env.TAG }} ${{ env.SHIELDS }} --clobber
env:
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Generates and uploads a release version when a new tag is pushed
name: Create release

on:
# trigger for tags starting with 'v'
push:
tags:
- v*

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Get the repository files
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Setup gradle
uses: gradle/actions/setup-gradle@v4

- name: Create release store file
run: |
RELEASE_STORE_FILE=$(readlink -f release_store_file)
echo -n "$RELEASE_STORE_FILE_ENCRYPTED" | base64 --decode > $RELEASE_STORE_FILE
echo "RELEASE_STORE_FILE=$RELEASE_STORE_FILE" >> "$GITHUB_ENV"
env:
RELEASE_STORE_FILE_ENCRYPTED: ${{ secrets.RELEASE_STORE_FILE }}

- name: Build & assemble
run: ./gradlew build assembleRelease
env:
RELEASE_STORE_PASSWORD: ${{ secrets.RELEASE_STORE_PASSWORD }}
RELEASE_KEY_ALIAS: ${{ secrets.RELEASE_KEY_ALIAS }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}

- name: Upload apk to release with the release notes
run: >
sed '/^$/q' ./app/src/main/play/release-notes/en-US/default.txt
|
gh release create $TAG
./app/build/outputs/apk/release/*.apk
--title="URLCheck ${TAG#v} release apk"
--notes-file -
--latest
--verify-tag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}

0 comments on commit 9f5720c

Please sign in to comment.