Auto release (#4) #72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Android CI | |
on: | |
workflow_dispatch: | |
push: | |
branches: [master, main] | |
paths-ignore: ['*.md'] | |
pull_request: | |
branches: [master, main] | |
paths-ignore: ['*.md'] | |
release: | |
types: [published] | |
jobs: | |
validation: | |
name: Gradle Validation | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/actions/wrapper-validation@v3 | |
build: | |
needs: validation | |
if: ${{ needs.validation.result == 'success' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: local-build-action | |
uses: ./.github/actions/build-android | |
with: | |
KEYSTORE_BASE_64: ${{ secrets.KEYSTORE_BASE_64 }} | |
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }} | |
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }} | |
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }} | |
release: | |
name: Auto release | |
needs: build | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.release.outputs.id }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Determine Last Tag | |
id: last_tag | |
uses: 'WyriHaximus/github-action-get-previous-tag@v1' | |
with: | |
fallback: 1.0.0 | |
- name: Get Current Version | |
id: current_version | |
shell: bash | |
run: | | |
echo "version=$(./gradlew :app:properties | grep archivesBaseName | cut -d "_" -f 2)" >> $GITHUB_OUTPUT | |
- name: Compare Versions and Trigger Release | |
id: release | |
if: ${{ steps.current_version.outputs.version != steps.last_tag.outputs.tag }} | |
uses: ncipollo/release-action@v1 | |
with: | |
name: 'WiFi List ${{steps.current_version.outputs.version}}' | |
tag: '${{steps.current_version.outputs.version}}' | |
generateReleaseNotes: true | |
upload: | |
name: Upload release | |
runs-on: ubuntu-latest | |
needs: [build, release] | |
if: ${{ needs.build.result == 'success' && (github.event_name == 'release' || needs.release.outputs.release_id)}} | |
steps: | |
- name: Set Tag | |
id: tag | |
shell: bash | |
run: echo "name=${{ github.event.release.tag_name || needs.release.outputs.release_id}}" >> $GITHUB_OUTPUT | |
- uses: actions/download-artifact@v4 | |
- name: Build debug apk | |
run: mv **/*.apk ./${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}.apk | |
- uses: termux/[email protected] | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ./${{ github.event.repository.name }}-${{ steps.tag.outputs.name }}.apk | |
tag: ${{ steps.tag.outputs.name }} | |
checksums: sha256,sha512,md5 |