-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor GitHub Actions workflow: Update checkout step to use actions…
…/checkout@v4 and setup-node@v4
- Loading branch information
Showing
1 changed file
with
21 additions
and
16 deletions.
There are no files selected for viewing
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
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 }} |