Flutter App Release #56
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: Flutter App Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
required: true | |
description: 'Version number to be released (e.g., 1.0.0)' | |
jobs: | |
bump_version: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ssh-key: ${{secrets.REPO_WRITE_TOKEN}} | |
- name: Update version in pubspec.yaml | |
run: | | |
export CURRENT_VERSION=$(grep "version:" pubspec.yaml | awk '{print $2}') | |
export VERSION_CODE=$(awk -F '+' '{print $2}' <<< $CURRENT_VERSION) | |
((VERSION_CODE++)) | |
export NEW_VERSION="${{ github.event.inputs.version }}+$VERSION_CODE" | |
sed -i "s/version: [0-9.]*+[0-9]*/version: $NEW_VERSION/" pubspec.yaml | |
git config --local user.name "GitHub Actions" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add pubspec.yaml | |
git commit -m "Update version to ${{ github.event.inputs.version }}" | |
git push | |
build: | |
needs: bump_version | |
uses: iyox-studios/iyox-wormhole/.github/workflows/build.yml@main | |
secrets: inherit | |
build_and_release: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts/ | |
pattern: app-* | |
merge-multiple: true | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux-x86_64 | |
path: artifacts/linux-x86_64/ | |
- name: List artifacts | |
run: | | |
zip -r ${{ github.workspace }}/artifacts/linux-x86_64.zip ${{ github.workspace }}/artifacts/linux-x86_64 | |
- name: Create a release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
generate_release_notes: false | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
name: "v${{ github.event.inputs.version }}" | |
tag_name: ${{ github.event.inputs.version }} | |
files: | | |
${{ github.workspace }}/artifacts/app-arm64-v8a-release.apk | |
${{ github.workspace }}/artifacts/app-armeabi-v7a-release.apk | |
${{ github.workspace }}/artifacts/app-x86_64-release.apk | |
${{ github.workspace }}/artifacts/app-release.aab | |
${{ github.workspace }}/artifacts/linux-x86_64.zip |