Skip to content

chore(ci): create v2 alpha release workflow #1719

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

Merged
merged 1 commit into from
Sep 28, 2023
Merged
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
77 changes: 77 additions & 0 deletions .github/workflows/make-v2-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Make Release v2 (pre-release)
on:
workflow_dispatch: {}
concurrency:
group: on-release-publish
jobs:
run-unit-tests:
uses: ./.github/workflows/reusable-run-linting-check-and-unit-tests.yml
publish-npm:
needs: run-unit-tests
# Needed as recommended by npm docs on publishing with provenance https://docs.npmjs.com/generating-provenance-statements
permissions:
id-token: write
contents: write
runs-on: ubuntu-latest
outputs:
RELEASE_VERSION: ${{ steps.set-release-version.outputs.RELEASE_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Setup NodeJS
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
with:
node-version: '18'
cache: 'npm'
- name: Setup auth tokens
run: |
npm set "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}"
- name: Setup dependencies
uses: ./.github/actions/cached-node-modules
- name: Version
run: |
# Version all packages to next major version (2.0.0) without pushing to git, generating changelog or running commit hooks
# Since the version stored in the lerna.json will always be a 1.x.x version, we manually set the version to 2.0.0
npx lerna version major --force-publish --no-push --no-git-tag-version --no-commit-hooks --no-changelog --yes
- name: Set alpha iteration
run: |
# Get the current alpha version from npm i.e 2.0.0-alpha.0 -> 0, 2.0.0-alpha.1 -> 1 (default to -1 if no alpha versions exist = first pre-release)
ITERATION=$(npm show @aws-lambda-powertools/commons time --json | jq -r 'to_entries | map(select(.key | startswith("2.0.0-alpha"))) | sort_by(.key) | last | .key // "-1"')
# Write the new version to the file
echo "{ \"iteration\": $((ITERATION + 1)) }" > v2.json
- name: Increment version in UA
run: |
# Increment the version in the UA
echo "// this file is auto generated, do not modify\nexport const PT_VERSION = '2.0.0-alpha.$(jq -r '.iteration' v2.json)';" > packages/commons/src/version.ts
- name: Build
run: |
npm run build:prod -w packages/batch \
-w packages/commons \
-w packages/idempotency \
-w packages/logger \
-w packages/metrics \
-w packages/parameters \
-w packages/tracer
- name: Pack packages
run: |
npm pack -w packages/batch \
-w packages/commons \
-w packages/idempotency \
-w packages/logger \
-w packages/metrics \
-w packages/parameters \
-w packages/tracer
- name: Publish to npm
run: |
npm publish aws-lambda-powertools-batch-*.tgz --tag next --provenance
npm publish aws-lambda-powertools-commons-*.tgz --tag next --provenance
npm publish aws-lambda-powertools-idempotency-*.tgz --tag next --provenance
npm publish aws-lambda-powertools-logger-*.tgz --tag next --provenance
npm publish aws-lambda-powertools-metrics-*.tgz --tag next --provenance
npm publish aws-lambda-powertools-parameters-*.tgz --tag next --provenance
npm publish aws-lambda-powertools-tracer-*.tgz --tag next --provenance
- name: Set release version
id: set-release-version
run: |
VERSION="2.0.0-alpha.$(cat v2.json | jq .iteration -r)"
echo RELEASE_VERSION="$VERSION" >> "$GITHUB_OUTPUT"