Merge pull request #19 from RedCommander735/develop #92
Workflow file for this run
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: Build | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'develop' | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- 'develop' | |
workflow_dispatch: | |
jobs: | |
archive-changelog: | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Save changelog | |
if: startsWith(github.ref, 'refs/tags/') | |
run: cp 'changelogs/CHANGELOG - latest.md' 'changelogs/CHANGELOG - ${{ github.ref_name }}.md' | |
- name: Commit changelog | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
git config --global user.name 'Github Actions' | |
git config --global user.email '[email protected]' | |
git add 'changelogs/CHANGELOG - ${{ github.ref_name }}.md' | |
git commit -am "Save changelog" | |
git push | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Decrypt | |
run: gpg --quiet --batch --yes --decrypt --passphrase="${{ secrets.KEYPASSWORD }}" --output ./android/app/keystore/upload-keystore.jks ./android/app/keystore/upload-keystore.jks.gpg | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: "17.x" | |
cache: 'gradle' | |
- uses: subosito/flutter-action@v2 | |
with: | |
flutter-version-file: 'pubspec.yaml' | |
channel: 'stable' | |
cache: true | |
- name: Get dependencies | |
run: flutter pub get | |
- name: Start release build | |
if: startsWith(github.ref, 'refs/tags/') | |
run: flutter build apk | |
env: | |
storePassword: ${{ secrets.STOREPASSWORD }} | |
keyPassword: ${{ secrets.KEYPASSWORD }} | |
keyAlias: 'upload' | |
storeFile: './keystore/upload-keystore.jks' | |
- name: Start debug build | |
if: startsWith(github.ref, 'refs/tags/') != true | |
run: flutter build apk --debug | |
env: | |
storePassword: ${{ secrets.STOREPASSWORD }} | |
keyPassword: ${{ secrets.KEYPASSWORD }} | |
keyAlias: 'upload' | |
storeFile: './keystore/upload-keystore.jks' | |
- name: Archive build artefact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: build/app/outputs/flutter-apk/*.apk | |
- name: Rename apk | |
if: startsWith(github.ref, 'refs/tags/') | |
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/${{ github.ref_name }}-release.apk | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: 'changelogs/CHANGELOG - latest.md' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: build/app/outputs/flutter-apk/${{ github.ref_name }}-release.apk |