-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Adding worflows for automated releases
- Loading branch information
Showing
8 changed files
with
188 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Release Authenticator | ||
on: | ||
push: | ||
branches: [ release ] | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
|
||
jobs: | ||
unit-tests: | ||
name: Run Unit Tests | ||
uses: ./.github/workflows/unit_tests.yml | ||
with: | ||
identifier: 'workflow-call-unit-test' | ||
|
||
release: | ||
environment: Release | ||
name: Release new Authenticator version | ||
needs: [unit-tests] | ||
runs-on: macos-latest | ||
env: | ||
GITHUB_EMAIL: [email protected] | ||
GITHUB_USER: aws-amplify-ops | ||
steps: | ||
- 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@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 | ||
with: | ||
ruby-version: '3.2.1' | ||
bundler-cache: true | ||
|
||
- name: Release Authenticator | ||
run: bundle exec fastlane 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Release - Kick-off | ||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b | ||
- name: Create PR to push main to release branch | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: "gh pr create --title 'chore: kickoff release' --body 'kickoff release' --head main --base 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
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Gemfile | ||
|
||
source 'https://rubygems.org' | ||
|
||
gem 'xcpretty', '0.3.0' | ||
gem 'fastlane', '2.205.1' | ||
eval_gemfile('fastlane/Pluginfile') | ||
|
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
test_output |
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
opt_out_usage | ||
default_platform(:swift) | ||
|
||
platform :swift do | ||
before_all do | ||
# Perform a fetch before inferring the next version | ||
# to reduce race conditions with simultaneous pipelines attempting to create the same tag | ||
sh('git', 'fetch', '--tags', '-f') | ||
sh('git', 'fetch') | ||
end | ||
|
||
desc "Create a release version by building and committing a changelog, pushing a tag to GitHub" | ||
lane :release do | ||
next_version, commits = calculate_next_release_version | ||
|
||
UI.message("Releasing version: #{next_version}") | ||
|
||
# Increment all specs and plists | ||
increment_versions(version: next_version) | ||
|
||
# Update Changelog | ||
changelog = build_changelog(version: next_version, commits: commits) | ||
write_changelog(changelog: changelog, path: 'CHANGELOG.md') | ||
|
||
# Update Package dependencies | ||
sh('bundle', 'exec', 'swift', 'package', 'update') | ||
|
||
# Commit and push | ||
release_commit(version: next_version) | ||
|
||
# Create tag and push to origin | ||
add_tag(version: next_version) | ||
end | ||
|
||
desc "Increment versions" | ||
private_lane :increment_versions do |options| | ||
version = options[:version].to_s | ||
set_key_value(file: "Sources/Authenticator/Constants/ComponentInformation.swift", key: "version", value: version) | ||
end | ||
|
||
desc "Commit and push" | ||
private_lane :release_commit do |options| | ||
next_version = options[:version] | ||
|
||
sh('git', 'config', '--global', 'user.email', ENV['GITHUB_EMAIL']) | ||
sh('git', 'config', '--global', 'user.name', ENV['GITHUB_USER']) | ||
|
||
commit_message = "chore: Release #{next_version} [skip ci]" | ||
sh('git', 'commit', '-am', commit_message) | ||
|
||
# push to origin | ||
sh('git', 'push', 'origin', 'release') | ||
sh('git', 'push', 'origin', 'release:main') | ||
end | ||
|
||
desc "Tag in git and push to GitHub" | ||
private_lane :add_tag do |options| | ||
next_version = options[:version] | ||
next_tag = "#{next_version}" | ||
|
||
add_git_tag(tag: next_tag) | ||
push_git_tags(tag: next_tag) | ||
end | ||
end |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Autogenerated by fastlane | ||
# | ||
# Ensure this file is checked in to source control! | ||
|
||
gem 'fastlane-plugin-release_actions', git: 'https://github.com/aws-amplify/amplify-ci-support', branch: 'main', glob: 'src/fastlane/release_actions/*.gemspec' |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
fastlane documentation | ||
---- | ||
|
||
# Installation | ||
|
||
Make sure you have the latest version of the Xcode command line tools installed: | ||
|
||
```sh | ||
xcode-select --install | ||
``` | ||
|
||
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane) | ||
|
||
# Available Actions | ||
|
||
## Swift | ||
|
||
### swift release | ||
|
||
```sh | ||
[bundle exec] fastlane swift release | ||
``` | ||
|
||
Create a release version by building and committing a changelog, pushing a tag to GitHub |