Skip to content

Commit

Permalink
Refactor GitHub Actions workflow: Update checkout step to use actions…
Browse files Browse the repository at this point in the history
…/checkout@v4 and setup-node@v4
  • Loading branch information
a179346 committed Sep 17, 2024
1 parent 19bda6e commit 91972c7
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,48 @@
name: Publish NPM Package

name: Publish Packages
on:
release:
types: [published]

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
publish-npm-packages:
runs-on: ubuntu-latest
permissions:
contents: 'write'
packages: 'write'
actions: 'read'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Install dependencies

- name: Install Dependencies
run: npm ci

- name: Git Identity
run: |
git config --global user.name '${GITHUB_ACTOR}'
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
- name: Prepare release branch
git config user.name github-actions
git config user.email [email protected]
- name: Prepare Release Branch
run: |
git switch -c "release/${GITHUB_REF:11}"
git push origin "release/${GITHUB_REF:11}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish packages
- name: Publish Packages
run: npx lerna publish ${{ github.event.release.tag_name }} --yes
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
- name: Remove release branch
- name: Remove Release Branch
run: |
git switch main
git branch -D "release/${GITHUB_REF:11}"
git push origin --delete "release/${GITHUB_REF:11}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 91972c7

Please sign in to comment.