Skip to content

Commit

Permalink
ci: improve publish
Browse files Browse the repository at this point in the history
  • Loading branch information
uiolee committed Jan 2, 2024
1 parent 91023f7 commit 9d6c61b
Showing 1 changed file with 18 additions and 54 deletions.
72 changes: 18 additions & 54 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,34 @@ on:
- "v*.*.*"

jobs:
build:
uses: ./.github/workflows/build.yml

publish-npm:
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
registry-url: https://registry.npmjs.org/

- uses: pnpm/action-setup@v2
name: Install pnpm
- uses: actions/download-artifact@v4
with:
version: 8

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
name: artifact

- uses: actions/cache@v3
name: Setup pnpm cache
- uses: actions/setup-node@v4
with:
path: |
${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm i

- name: build
run: |
pnpm esb
# node-version: "lts/*"
registry-url: https://registry.npmjs.org/

- run: npm publish --provenance --access public
- run: npm publish --provenance --access public --registry=https://registry.npmjs.org/
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

publish-ghp:
needs: build
runs-on: ubuntu-latest
env:
SCOPE: "@${{github.repository_owner}}"
Expand All @@ -74,44 +58,24 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: "recursive"

- uses: actions/setup-node@v4
with:
node-version: "lts/*"
# node-version: "lts/*"
registry-url: "https://npm.pkg.github.com/"
# Defaults to the user or organization that owns the workflow file
scope: ${{env.SCOPE}}
token: ${{secrets.GITHUB_TOKEN}}
always-auth: true

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
- uses: actions/download-artifact@v4
with:
path: |
${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
name: artifact

- name: Install Dependencies
run: pnpm i

- name: build
- name: rename package name
run: |
pnpm esb
- run: |
node .github/workflows/package.cjs
- run: npm publish --registry=https://npm.pkg.github.com
- run: npm publish --access public --registry=https://npm.pkg.github.com
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 comments on commit 9d6c61b

Please sign in to comment.