Skip to content

Commit

Permalink
Update release action to not commit version
Browse files Browse the repository at this point in the history
  • Loading branch information
JElgar committed Aug 11, 2024
1 parent c7442c8 commit 08c843d
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 53 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/android-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ on:
workflow_dispatch:
workflow_call:
inputs:
ref:
build-name:
required: true
type: string
build-number:
required: true
type: string

Expand All @@ -18,8 +21,6 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: 🧰 Setup app
uses: ./.github/actions/setup-app
Expand All @@ -40,7 +41,7 @@ jobs:
cache: 'gradle'

- name: 🛠️ Build app
run: flutter build appbundle --release
run: flutter build appbundle --release --build-name=${{ inputs.build-name }} --build-number=${{ inputs.build-number }}

# - name: ⏫ Upload bundle as gh artifact
# uses: actions/upload-artifact@v2
Expand Down
69 changes: 27 additions & 42 deletions .github/workflows/flutter-ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,50 @@ on:
- '[0-9]+.[0-9]+.[0-9]+*'

workflow_dispatch: # to manually run this workflow
inputs:
version:
description: 'Version number to release'
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
prepare:
name: Release setup
runs-on: macos-latest
test:
name: Test
uses: now-u/now-u-app/.github/workflows/flutter-test.yml@main
secrets: inherit

get-version:
name: Get version
runs-on: ubuntu-latest
outputs:
ref: ${{ steps.commit.outputs.commit_long_sha }}
timeout-minutes: 30
build-name: ${{ steps.get-build-name.outputs.build-name }}
build-number: ${{ steps.get-build-number.outputs.build-number }}
env:
TAG: ${{ github.event.inputs.version != '' && github.event.inputs.version || github.ref_name }}
steps:
- uses: actions/checkout@v4

- name: Extract version from tag
uses: damienaicheh/[email protected]

- name: Setup flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable' # 'dev', 'alpha', default to: 'stable'
flutter-version: '3.22.3'
cache: true

- name: Setup cider
run: |
export PATH="$PATH":"$HOME/.pub-cache/bin"
flutter pub global activate cider
- name: Set version
run: |
echo "Setting version to ${{ github.ref_name }}"
cider version ${{ github.ref_name }}
- name: Update change log
run: cider release

- id: commit
name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: GitHub Actions
author_email: [email protected]
branch: main
message: "Release ${{ github.ref_name }} - Updates version in pubspec.yaml & update change log"
- id: get-build-name
run: echo "build-name=${TAG%+*}" >> "$GITHUB_OUTPUT"
- id: get-build-number
run: echo "build-number=${BRANCH##*+}" >> "$GITHUB_OUTPUT"

release-ios:
name: Release IOS
needs: prepare
needs: [test, get-version]
uses: now-u/now-u-app/.github/workflows/ios-release.yml@main
secrets: inherit
with:
ref: ${{ needs.prepare.outputs.ref }}
build-name: ${{ needs.get-version.outputs.build-name }}
build-number: ${{ needs.get-version.outputs.build-number }}

release-android:
name: Release Android
needs: prepare
needs: [test, get-version]
uses: now-u/now-u-app/.github/workflows/android-release.yml@main
secrets: inherit
with:
ref: ${{ needs.prepare.outputs.ref }}
build-name: ${{ needs.get-version.outputs.build-name }}
build-number: ${{ needs.get-version.outputs.build-number }}
6 changes: 4 additions & 2 deletions .github/workflows/flutter-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Flutter tests

# Run this workflow every time a new commit pushed to your repository
on: pull_request
on:
pull_request:
workflow_call:

jobs:
test:
Expand All @@ -20,7 +22,7 @@ jobs:
- name: Setup app
uses: ./.github/actions/setup-app

# - run: pod repo update
# - run: pod repo update

- name: Flutter format
run: dart format -o none --set-exit-if-changed .
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ios-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ on:
workflow_dispatch:
workflow_call:
inputs:
ref:
build-name:
required: true
type: string
build-number:
required: true
type: string

Expand All @@ -21,8 +24,6 @@ jobs:
# Checks-out our repository under $GITHUB_WORKSPACE, so our job can access it
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

# Install the Apple certificate and provisioning profile
- name: 🔑 Install the Apple certificate and provisioning profile
Expand Down Expand Up @@ -72,7 +73,7 @@ jobs:

# Build and sign the ipa using a single flutter command
- name: 🛠️ Building IPA
run: flutter build ipa --release --export-options-plist=ios/Runner/ExportOptions.plist
run: flutter build ipa --release --export-options-plist=ios/Runner/ExportOptions.plist --build-name=${{ inputs.build-name }} --build-number=${{ inputs.build-number }}

# Collect the file and upload as artifact
- name: ⏫ Upload bundle as gh artifact
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ description: now-u App
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2.0.10+60

version: 0.0.0+0
publish_to: none

environment:
Expand Down

0 comments on commit 08c843d

Please sign in to comment.