Auto release #50
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 | |
outputs: | |
app_version: ${{steps.local-build-action.outputs.app_version}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: local-build-action | |
id: 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 | |
if: ${{ needs.build.result == 'success' && github.event_name != 'release'}} | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.release.outputs.id }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags | |
- name: Determine Last Tag | |
id: last_tag | |
uses: 'WyriHaximus/github-action-get-previous-tag@v1' | |
with: | |
fallback: 1.0.0 | |
- name: Compare Versions and Trigger Release | |
id: release | |
if: ${{ needs.build.outputs.app_version != steps.last_tag.outputs.tag }} | |
uses: ncipollo/release-action@v1 | |
with: | |
name: 'WiFi List ${{needs.build.outputs.app_version}}' | |
tag: '${{needs.build.outputs.app_version}}' | |
generateReleaseNotes: true | |
makeLatest: true | |
upload: | |
name: Upload release | |
runs-on: ubuntu-latest | |
needs: [build, release] | |
if: ${{ always() && 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.build.outputs.app_version }}" >> $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 |