Flutter App Release #44
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: 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 | |
- 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 }}" | |
- name: Push Changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: actions-improvements | |
build: | |
needs: bump_version | |
uses: iyox-studios/iyox-wormhole/.github/workflows/build.yml@actions-improvements | |
build_and_release: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create a release | |
uses: actions/create-release@v1 | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
release_name: "v${{ github.event.inputs.version }}" | |
body: "Release notes for v${{ github.event.inputs.version }}" | |
draft: true | |
prerelease: false | |
- 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 | |
ls ${{ github.workspace }}/artifacts/ | |
cd ${{ github.workspace }}/artifacts/ && ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' | |
- name: Attach artifacts to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_content_type: application/octet-stream | |
asset_name: app-armeabi-v7a-release.apk | |
asset_path: ${{ github.workspace }}/artifacts/app-armeabi-v7a-release.apk | |
- name: Attach artifacts to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_content_type: application/octet-stream | |
asset_name: linux-x86_64.zip | |
asset_path: ${{ github.workspace }}/artifacts/linux-x86_64.zip |