Skip to content

Commit

Permalink
Align release process by supporting npm provenance and tag and releas…
Browse files Browse the repository at this point in the history
…e-directory (#1216)
  • Loading branch information
frederikprijck authored Dec 12, 2023
1 parent ee11a30 commit 689712e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/actions/get-release-notes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Return the release notes extracted from the PR body
# TODO: Remove once the common repo is public.
#
inputs:
version :
version:
required: true
repo_name:
required: false
Expand Down
16 changes: 15 additions & 1 deletion .github/actions/publish-package/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
required: true
npm-token:
required: true
version:
required: true
release-directory:
default: './'

runs:
using: composite
Expand All @@ -27,6 +31,16 @@ runs:

- name: Publish release to NPM
shell: bash
run: npm publish
working-directory: ${{ inputs.release-directory }}
run: |
if [[ "${VERSION}" == *"beta"* ]]; then
TAG="beta"
elif [[ "${VERSION}" == *"alpha"* ]]; then
TAG="alpha"
else
TAG="latest"
fi
npm publish --provenance --tag $TAG
env:
NODE_AUTH_TOKEN: ${{ inputs.npm-token }}
VERSION: ${{ inputs.version }}
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:

permissions:
contents: write
id-token: write # For publishing to npm using --provenance

env:
NODE_VERSION: 18
Expand Down Expand Up @@ -36,7 +37,7 @@ jobs:
uses: ./.github/actions/get-prerelease
with:
version: ${{ steps.get_version.outputs.version }}

# Get the release notes
# This will expose the release notes as env.RELEASE_NOTES
- id: get_release_notes
Expand All @@ -62,6 +63,7 @@ jobs:
- uses: ./.github/actions/publish-package
with:
node-version: ${{ env.NODE_VERSION }}
version: ${{ steps.get_version.outputs.version }}
npm-token: ${{ secrets.NPM_TOKEN }}

# Create a release for the tag
Expand Down

0 comments on commit 689712e

Please sign in to comment.