Skip to content

Commit

Permalink
[CI] Run release action on workflow dispatch (#3386)
Browse files Browse the repository at this point in the history
  • Loading branch information
testableapple authored Aug 16, 2024
1 parent 52a929f commit 95e2e2d
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/release-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ on:
types:
- closed

workflow_dispatch:
inputs:
version:
description: 'Release version'
type: string
required: true

jobs:
release:
name: Publish new release
Expand All @@ -20,21 +27,30 @@ jobs:

- uses: actions/[email protected]

- uses: ./.github/actions/ruby-cache

- name: Extract version from input (for workflow dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
if [ "$BRANCH_NAME" != "main" ]; then
echo "This workflow can only be run on the main branch."
exit 1
fi
echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Extract version from branch name (for release branches)
if: startsWith(github.event.pull_request.head.ref, 'release/')
if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'release/') }}
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- uses: ./.github/actions/ruby-cache

- name: "Fastlane - Publish Release"
if: startsWith(github.event.pull_request.head.ref, 'release/')
if: ${{ github.event_name == 'workflow_dispatch' || startsWith(github.event.pull_request.head.ref, 'release/') }}
env:
GITHUB_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
APPSTORE_API_KEY: ${{ secrets.APPSTORE_API_KEY }}
run: bundle exec fastlane publish_release version:${{ env.RELEASE_VERSION }} --verbose

0 comments on commit 95e2e2d

Please sign in to comment.