chore: update release workflow to include NPM_TOKEN #11
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
name: Release | |
on: | |
# Trigger the workflow on push on the main branch | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "LICENSE" | |
- "README.md" | |
- "CHANGELOG.md" | |
- "CONTRIBUTING.md" | |
- ".editorconfig" | |
- "demo/**" | |
- "assets/**" | |
- ".vscode/**" | |
- ".github/workflows/publish.yml" | |
# Allow manual triggering of the workflow | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: read # for checkout | |
concurrency: | |
group: ${{ github.job }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
STORE_PATH: "" | |
EDITOR: true | |
GIT_COMMITTER_NAME: "Wilfried AGO" | |
GIT_COMMITTER_EMAIL: "[email protected]" | |
jobs: | |
release: | |
name: 🚀 Create a new release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
id-token: write # to enable use of OIDC for npm provenance | |
steps: | |
- name: ⬇️ Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 🛑 Configure Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: 🪄 Installing pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
run_install: false | |
- name: 🏪 Getting pnpm store directory | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- name: ♻️ Setting up pnpm cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: 📥 Installing project dependencies | |
run: pnpm install --frozen-lockfile | |
- name: 📦 Building package | |
run: pnpm package | |
- name: 📝 Import GPG key | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
git_committer_name: ${{ env.GIT_COMMITTER_NAME }} | |
git_committer_email: ${{ env.GIT_COMMITTER_EMAIL }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
trust_level: ultimate | |
- name: 🚀 Release a new version | |
run: pnpm release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |