Skip to content

Commit

Permalink
ci: separate build and publish steps (#1106)
Browse files Browse the repository at this point in the history
* chore: up dev deps

* ci: separate build and publish steps
  • Loading branch information
antongolub authored Feb 22, 2025
1 parent be0990f commit 5f48c73
Show file tree
Hide file tree
Showing 4 changed files with 241 additions and 68 deletions.
32 changes: 27 additions & 5 deletions .github/workflows/dev-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,31 @@ on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- run: npm ci
- run: npm test
env:
FORCE_COLOR: 3
- run: node scripts/clean-package-json.mjs
- uses: actions/upload-artifact@v4
with:
name: build-${{ github.run_id }}
path: |
build
package.json
retention-days: 1

publish:
needs: build
runs-on: ubuntu-latest
permissions:
checks: read
Expand All @@ -20,14 +44,12 @@ jobs:
with:
node-version: 22
cache: 'npm'
- run: npm ci
- run: npm test
env:
FORCE_COLOR: 3
- uses: actions/download-artifact@v4
with:
name: build-${{ github.run_id }}
- run: echo "//wombat-dressing-room.appspot.com/:_authToken=$AUTH_TOKEN" >> .npmrc
env:
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
- run: |
npm version $(node --eval="process.stdout.write(require('./package.json').version)")-dev.$(git rev-parse --short HEAD) --no-git-tag-version
node scripts/clean-package-json.mjs
npm publish --provenance --access=public --no-git-tag-version --tag dev
32 changes: 27 additions & 5 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,31 @@ on:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'npm'
- run: npm ci
- run: npm test
env:
FORCE_COLOR: 3
- run: node scripts/clean-package-json.mjs
- uses: actions/upload-artifact@v4
with:
name: build-${{ github.run_id }}
path: |
build
package.json
retention-days: 1

publish:
needs: build
runs-on: ubuntu-latest
permissions:
checks: read
Expand All @@ -22,11 +46,9 @@ jobs:
with:
node-version: 22
cache: 'npm'
- run: npm ci
- run: npm test
env:
FORCE_COLOR: 3
- run: node scripts/clean-package-json.mjs
- uses: actions/download-artifact@v4
with:
name: build-${{ github.run_id }}
- run: echo "//wombat-dressing-room.appspot.com/:_authToken=$AUTH_TOKEN" >> .npmrc
env:
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
Expand Down
Loading

0 comments on commit 5f48c73

Please sign in to comment.