Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(GHA): add semantic release manual gha #206

Merged
merged 33 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/sem_ver.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This workflow tests the installation of semantic release
name: Semantic Release Test Installation

on:
pull_request:

jobs:
semantic-release:
runs-on: macos-latest
permissions:
id-token: write
contents: read
steps:
- name: Support longpaths on Git checkout
run: |
git config --global core.longpaths true
- uses: actions/checkout@v3
# We only pull in the submodules we need to build the library
- run: git submodule update --init libraries

# We need access to the role that is able to get CI Bot Creds
- name: Configure AWS Credentials for Release
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::587316601012:role/GitHub-CI-CI-Bot-Credential-Access-Role-us-west-2
role-session-name: CI_Bot_Release

- name: Upgrade Node
uses: actions/setup-node@v4
with:
node-version: 20

# Use AWS Secrets Manger GHA to retrieve CI Bot Creds
- name: Get CI Bot Creds Secret
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: Github/aws-crypto-tools-ci-bot
parse-json-secrets: true

# Log in as the CI Bot
- name: Log in as CI Bot
run: |
echo ${{env.GITHUB_AWS_CRYPTO_TOOLS_CI_BOT_ESDK_RELEASE_TOKEN}} > token.txt
gh auth login --with-token < token.txt
rm token.txt
gh auth status

# Test to see if we can setup semantic release
- name: Test Semantic Release Installation
uses: actions/checkout@v4
with:
ref: main
- run: |
make setup_semantic_release
73 changes: 73 additions & 0 deletions .github/workflows/semantic_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow runs semantic release, bumps, generates changelog, and tags the project
name: Semantic Release

on:
workflow_dispatch:
inputs:
dry-run:
description: "Are you releasing a new version? (y/n)"
required: true
type: string

jobs:
semantic-release:
# there is no easy way in gha to check if the actor is part of the team, running semantic release is a more
# privileged operation, so we must make sure this list of users is a subset of the users labeled as maintainers of
# https://github.com/orgs/aws/teams/aws-crypto-tools
if: contains('["seebees","texastony","ShubhamChaturvedi7","lucasmcdonald3","josecorella","imabhichow","rishav-karanjit","antonf-amzn","justplaz","ajewellamz"]', github.actor)
lucasmcdonald3 marked this conversation as resolved.
Show resolved Hide resolved
runs-on: macos-latest
permissions:
id-token: write
contents: read
steps:
- name: Support longpaths on Git checkout
run: |
git config --global core.longpaths true
- uses: actions/checkout@v3
# We only pull in the submodules we need to build the library
- run: git submodule update --init libraries

# We need access to the role that is able to get CI Bot Creds
- name: Configure AWS Credentials for Release
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: us-west-2
role-to-assume: arn:aws:iam::587316601012:role/GitHub-CI-CI-Bot-Credential-Access-Role-us-west-2
role-session-name: CI_Bot_Release

- name: Upgrade Node
uses: actions/setup-node@v4
with:
node-version: 20

# Use AWS Secrets Manger GHA to retrieve CI Bot Creds
- name: Get CI Bot Creds Secret
uses: aws-actions/aws-secretsmanager-get-secrets@v2
with:
secret-ids: Github/aws-crypto-tools-ci-bot
parse-json-secrets: true

# Log in as the CI Bot
- name: Log in as CI Bot
run: |
echo ${{env.GITHUB_AWS_CRYPTO_TOOLS_CI_BOT_ESDK_RELEASE_TOKEN}} > token.txt
gh auth login --with-token < token.txt
rm token.txt
gh auth status

# Set up semantic release
- name: Setup Semantic Release
run: |
make setup_semantic_release

# Run semantic release in dry run mode if input matches
- name: Run Semantic Release in dry run mode
if: ${{inputs.dry-run == 'n'}}
run: |
make dry_run_semantic_release

# Run semantic release if input matches
- name: Run Semantic Release
if: ${{inputs.dry-run == 'y'}}
run: |
make run_semantic_release
2 changes: 1 addition & 1 deletion .releaserc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Runtimes = {
* @type {import('semantic-release').GlobalConfig}
*/
module.exports = {
//branches: ["main"],
branches: ["main"],
repositoryUrl:
"[email protected]:aws/aws-cryptographic-material-providers-library.git",
plugins: [
Expand Down
Loading