Skip to content

Commit

Permalink
ci(publish-npm.yml): added attaching head to main when pubishing for …
Browse files Browse the repository at this point in the history
…npm publish compliance
  • Loading branch information
KemingHe committed Aug 2, 2024
1 parent 795f119 commit 93c39af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
# 'latest' may fall behind the actual latest stable release of pnpm.

- name: Install dependencies
run : pnpm install
run : pnpm install --frozen-lockfile

- name: Set up Node.js ${{ vars.DEFAULT_NODE_MAJOR_VERSION }}
uses: 'actions/setup-node@v4'
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,32 @@ jobs:
permissions:
contents: read

# Restrictly only one publishing job per workflow run.
# Restrict only one publishing job per workflow run.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

steps:
- name: Checkout code
uses: 'actions/checkout@v4'
with:
fetch-depth: 0

# Attach HEAD to main to avoid detached HEAD state.
# And to ensure publishing from main branch only.
# Added hard reset to ensure the branch is clean.
- name: Attach HEAD to main branch
run: |
set -e;
git checkout main;
git reset --hard;
- name: Install pnpm
uses: 'pnpm/action-setup@v4'
with:
version: ${{ vars.DEFAULT_PNPM_FULL_VERSION }}

- name: Install dependencies
run : pnpm install
run : pnpm install --frozen-lockfile

- name: Set up Node.js ${{ vars.DEFAULT_NODE_MAJOR_VERSION }}
uses: 'actions/setup-node@v4'
Expand Down

0 comments on commit 93c39af

Please sign in to comment.