From 199397ff0cc45e483d351e1604d18ea7a9b27c89 Mon Sep 17 00:00:00 2001 From: eudiwtech Date: Wed, 15 Jan 2025 10:38:57 +0100 Subject: [PATCH] feat: implement workflow_dispatch version --- .github/actions/setup/action.yml | 16 +++++------ .github/workflows/release.yml | 48 +++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index a68bf61..9c91581 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -7,19 +7,17 @@ runs: shell: bash run: corepack enable - id: setup-node - uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2 + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 with: node-version-file: '.node-version' - id: yarn-cache uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + env: + cache-name: cache-node-modules with: - path: | - **/node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }} - restore-keys: | - ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - ${{ runner.os }}-yarn- - - name: Install dependencies - if: steps.yarn-cache.outputs.cache-hit != 'true' + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} + - id: install-packages run: yarn install --frozen-lockfile shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bdabae1..f1a8895 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,17 @@ name: Build and Deploy on: - push: - branches: - - main + workflow_dispatch: + inputs: + releaseLevel: + description: 'Version to bump' + required: true + type: choice + default: minor + options: + - major + - minor + - patch jobs: run-static-checks: @@ -38,7 +46,20 @@ jobs: run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" - yarn start-fix-cycle + + if [[ ${{ github.event.inputs.releaseLevel }} == "major" ]]; then + echo "Bumping the major version" + yarn start-breaking-cycle + elif [[ ${{ github.event.inputs.releaseLevel }} == "minor" ]]; then + echo "Bumping the minor version" + yarn start-release-cycle + elif [[ ${{ github.event.inputs.releaseLevel }} == "patch" ]]; then + echo "Bumping the patch version" + yarn start-fix-cycle + else + echo "Unknown release level: ${{ github.event.inputs.releaseLevel }}" + exit 1 + fi - id: push-tags run: | git push --no-verify --follow-tags origin HEAD:${GITHUB_REF#refs/heads/} @@ -50,26 +71,27 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} release-android: - needs: run-static-checks + needs: bump-app-version environment: prod runs-on: ubuntu-latest steps: - id: checkout - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #v3.5.2 with: fetch-depth: 0 + ref: ${{ needs.bump-app-version.outputs.currentAppVersion }} - id: setup uses: ./.github/actions/setup - - id: setup-jdk + - id: setup-jdk-17 uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 #v3.11.0 with: - java-version: '11' + java-version: '17' distribution: 'temurin' cache: gradle - id: setup-android-sdk - uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc #v2.0.10 + uses: android-actions/setup-android@00854ea68c109d98c75d956347303bf7c45b0277 #v3.2.1 - id: setup-ruby - uses: ruby/setup-ruby@d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c #v1.149.0 + uses: ruby/setup-ruby@401c19e14f474b54450cd3905bb8b86e2c8509cf #v1.204.0 with: bundler-cache: true - id: build-release-android @@ -78,7 +100,7 @@ jobs: cd android && bundle exec fastlane alpha shell: bash env: - RUBYOPT: '-rostruct' + RUBYOPT: '-rostruct' # TODO: Remove when https://github.com/fastlane/fastlane/pull/21950 gets released ENCODED_IOAPP_JSON_KEY_FILE: ${{secrets.ENCODED_IOAPP_JSON_KEY_FILE}} ENCODED_IO_APP_RELEASE_KEYSTORE: ${{secrets.ENCODED_IO_APP_RELEASE_KEYSTORE}} IO_APP_RELEASE_STORE_FILE: ${{secrets.IO_APP_RELEASE_STORE_FILE}} @@ -86,7 +108,7 @@ jobs: IO_APP_RELEASE_KEY_ALIAS: ${{secrets.IO_APP_RELEASE_KEY_ALIAS}} IO_APP_RELEASE_KEY_PASSWORD: ${{secrets.IO_APP_RELEASE_KEY_PASSWORD}} release-ios: - needs: run-static-checks + needs: bump-app-version environment: prod runs-on: macos-14 steps: @@ -100,7 +122,7 @@ jobs: - id: setup uses: ./.github/actions/setup - id: setup-ruby - uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 #v1.171.0 + uses: ruby/setup-ruby@401c19e14f474b54450cd3905bb8b86e2c8509cf #v1.204.0 with: bundler-cache: true - id: prepare-ios-build