Skip to content

Commit

Permalink
chore(ci): split release workflows (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcowindt authored May 3, 2023
1 parent 869fa92 commit e6604cb
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,41 +1,16 @@
name: Release
name: Release Android

on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version to release, 0.5.1 (without 'v')"
required: true

jobs:
ios:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.API_GITHUB_TOKEN }}

- name: Setup environment
id: setup
run: |
git clone https://github.com/flutter/flutter.git -b stable --depth=1
flutter/bin/flutter doctor
echo ::set-output name=tag::${GITHUB_REF##*/}
- name: Build
run: |
flutter/bin/flutter build ios --no-codesign --release
cd build/ios/
mv iphoneos Payload
zip -r WiiMoteDSU-${{ steps.setup.outputs.tag }}.ipa Payload
- name: Upload assets
uses: AButler/[email protected]
with:
files: build/ios/WiiMoteDSU-${{ steps.setup.outputs.tag }}.ipa
release-tag: ${{ steps.setup.outputs.tag }}
repo-token: ${{ secrets.API_GITHUB_TOKEN }}

android:
runs-on: ubuntu-latest

Expand All @@ -49,6 +24,8 @@ jobs:
uses: actions/checkout@v3
with:
token: ${{ secrets.API_GITHUB_TOKEN }}
# default is '', i.e. commit that triggered this event
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' && format('refs/tags/v{0}', github.event.inputs.version) || ''}}

- name: Setup Java
uses: actions/setup-java@v3
Expand All @@ -65,9 +42,19 @@ jobs:
id: setup
run: |
flutter pub get
- name: Setup version and tag from commit
if: github.event_name != 'workflow_dispatch'
run: |
echo "tag=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF##*/v}" >> $GITHUB_OUTPUT
- name: Setup version and tag from workflow_dispatch
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != ''
run: |
echo "tag=v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
- name: Set Version
run: sed -i 's/1337.42.1337+42/${{ steps.setup.outputs.version }}+${{ github.run_number }}/g' pubspec.yaml

Expand All @@ -91,7 +78,7 @@ jobs:
flutter build appbundle --release
cd build/app/outputs/flutter-apk/
mv app-release.apk WiiMoteDSU-${{ steps.setup.outputs.tag }}.apk
cd ../release/app-release.aab
cd ../release/
mv app-release.aab WiiMoteDSU-${{ steps.setup.outputs.tag }}.aab
- name: Upload assets
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/release-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Release iOS

on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version to release, 0.5.1 (without 'v')"
required: true

jobs:
ios:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.API_GITHUB_TOKEN }}
# default is '', i.e. commit that triggered this event
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' && format('refs/tags/v{0}', github.event.inputs.version) || ''}}

- name: Setup environment
id: setup
run: |
git clone https://github.com/flutter/flutter.git -b stable --depth=1
flutter/bin/flutter doctor
- name: Deps
id: deps
run: flutter pub get

- name: Setup version and tag from commit
if: github.event_name != 'workflow_dispatch'
run: |
echo "tag=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
echo "version=${GITHUB_REF##*/v}" >> $GITHUB_OUTPUT
- name: Setup version and tag from workflow_dispatch
if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != ''
run: |
echo "tag=v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
- name: Build
run: |
flutter/bin/flutter build ios --no-codesign --release
cd build/ios/
mv iphoneos Payload
zip -r WiiMoteDSU-${{ steps.setup.outputs.tag }}.ipa Payload
- name: Upload assets
uses: AButler/[email protected]
with:
files: build/ios/WiiMoteDSU-${{ steps.setup.outputs.tag }}.ipa
release-tag: ${{ steps.setup.outputs.tag }}
repo-token: ${{ secrets.API_GITHUB_TOKEN }}

0 comments on commit e6604cb

Please sign in to comment.