-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Adding unstable releases. Removing need of a release branch an…
…d instead kicking off the release by merging into main
- Loading branch information
Showing
3 changed files
with
119 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
name: Release Authenticator | ||
on: | ||
push: | ||
branches: [ release ] | ||
branches: [ main ] | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
jobs: | ||
determine-release-type: | ||
name: Determine the release type | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release-type: ${{ steps.release-type.outputs.value }} | ||
steps: | ||
- id: release-type | ||
run: | | ||
if ${{ github.event.head_commit.author.username == 'github-actions[bot]' && startsWith(github.event.head_commit.message, 'chore: Release ') }}; then | ||
VALUE=stable | ||
else | ||
VALUE=unstable | ||
fi | ||
echo "value=$VALUE" >> $GITHUB_OUTPUT | ||
unit-tests: | ||
name: Run Unit Tests | ||
uses: ./.github/workflows/unit_tests.yml | ||
|
@@ -16,8 +31,8 @@ jobs: | |
|
||
release: | ||
environment: Release | ||
name: Release new Authenticator version | ||
needs: [unit-tests] | ||
name: Release new Authenticator ${{ needs.determine-release-type.outputs.release-type }} version | ||
needs: [determine-release-type, unit-tests] | ||
runs-on: macos-latest | ||
env: | ||
GITHUB_EMAIL: [email protected] | ||
|
@@ -53,5 +68,24 @@ jobs: | |
ruby-version: '3.2.1' | ||
bundler-cache: true | ||
|
||
- name: Release Authenticator | ||
run: bundle exec fastlane release | ||
- name: Release unstable version | ||
if: needs.determine-release-type.outputs.release-type == 'unstable' | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: bundle exec fastlane unstable_release | ||
|
||
- name: Determine stable release version | ||
id: determine-release-version | ||
if: needs.determine-release-type.outputs.release-type == 'stable' | ||
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1 | ||
with: | ||
result-encoding: string | ||
script: | | ||
const matches = `${{ github.event.head_commit.message }}`.match(/[0-9]+\.[0-9]+\.[0-9]+/) ?? [] | ||
return matches.length > 0 ? matches[0] : "" | ||
- name: Release stable version | ||
if: steps.determine-release-version.outputs.result != '' | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: bundle exec fastlane stable_release version:${{ steps.determine-release-version.outputs.result }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,49 @@ on: | |
workflow_dispatch: | ||
|
||
permissions: | ||
id-token: write | ||
pull-requests: write | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
|
||
environment: Release | ||
name: Kick off new Authenticator release | ||
runs-on: macos-latest | ||
env: | ||
GITHUB_EMAIL: [email protected] | ||
GITHUB_USER: aws-amplify-ops | ||
steps: | ||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b | ||
- name: Create PR to push main to release branch | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@8c3f20df09ac63af7b3ae3d7c91f105f857d8497 #v4 | ||
with: | ||
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }} | ||
role-session-name: ${{ format('{0}.release', github.run_id) }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
mask-aws-account-id: true | ||
|
||
- id: retrieve-token | ||
name: Retrieve Token | ||
env: | ||
DEPLOY_SECRET_ARN: ${{ secrets.DEPLOY_SECRET_ARN }} | ||
run: | | ||
PAT=$(aws secretsmanager get-secret-value \ | ||
--secret-id "$DEPLOY_SECRET_ARN" \ | ||
| jq -r ".SecretString | fromjson | .Credential") | ||
echo "token=$PAT" >> $GITHUB_OUTPUT | ||
- name: Checkout repo | ||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 | ||
with: | ||
fetch-depth: 10 | ||
token: ${{steps.retrieve-token.outputs.token}} | ||
|
||
- name: Setup Ruby | ||
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0 | ||
with: | ||
ruby-version: '3.2.1' | ||
bundler-cache: true | ||
|
||
- name: Kick off Authenticator release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: "gh pr create --title 'chore: kickoff release' --body 'kickoff release' --head main --base release" | ||
GH_TOKEN: ${{ github.token }} | ||
run: bundle exec fastlane kickoff_release |
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