Skip to content

Commit 13a5460

Browse files
authored
ci: publish through a reusable workflow that prepares the build (#13)
The publish job ran nuxt-module-build without .nuxt/tsconfig.json and failed for v0.1.0. publish.yml now runs dev:prepare first, is called by release-please after a release and can be started by hand for an existing tag.
1 parent 44f3339 commit 13a5460

2 files changed

Lines changed: 54 additions & 23 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: publish
2+
3+
# Publishes a released version to GitHub Packages. release-please.yml calls it after a release; it can
4+
# also be started by hand for an existing tag, for example when a publish failed after the tag was made.
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
ref:
10+
description: "Tag or commit to publish"
11+
required: true
12+
type: string
13+
workflow_dispatch:
14+
inputs:
15+
ref:
16+
description: "Tag to publish, e.g. v0.1.0"
17+
required: true
18+
type: string
19+
20+
permissions:
21+
contents: read
22+
packages: write
23+
24+
jobs:
25+
publish:
26+
name: publish to GitHub Packages
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v7
30+
with:
31+
ref: ${{ inputs.ref }}
32+
persist-credentials: false
33+
34+
- uses: pnpm/action-setup@v6.1.1
35+
36+
- uses: actions/setup-node@v7.1.0
37+
with:
38+
node-version-file: .nvmrc
39+
cache: pnpm
40+
registry-url: https://npm.pkg.github.com
41+
scope: '@onelitefeathernet'
42+
43+
- run: pnpm install --frozen-lockfile
44+
45+
# nuxt-module-build reads .nuxt/tsconfig.json, which `nuxt-module-build prepare` writes.
46+
- run: pnpm dev:prepare
47+
48+
- run: pnpm publish --no-git-checks
49+
env:
50+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: release-please
22

33
# One release for the whole package. release-please keeps the release pull request up to date on main;
4-
# when it is merged, the release is created and tagged. The publish job then publishes the released
4+
# when it is merged, the release is created and tagged. The publish job (publish.yml) then publishes the released
55
# commit to GitHub Packages. Tags created with GITHUB_TOKEN start no workflow, so nothing listens for a
66
# tag push.
77

@@ -18,30 +18,11 @@ jobs:
1818
uses: OneLiteFeatherNET/workflows/.github/workflows/release-please.yml@v2.9.1
1919

2020
publish:
21-
name: publish to GitHub Packages
2221
needs: release-please
2322
if: needs.release-please.outputs.release_created == 'true'
24-
runs-on: ubuntu-latest
2523
permissions:
2624
contents: read
2725
packages: write
28-
steps:
29-
- uses: actions/checkout@v7
30-
with:
31-
ref: ${{ needs.release-please.outputs.sha }}
32-
persist-credentials: false
33-
34-
- uses: pnpm/action-setup@v6.1.1
35-
36-
- uses: actions/setup-node@v7.1.0
37-
with:
38-
node-version-file: .nvmrc
39-
cache: pnpm
40-
registry-url: https://npm.pkg.github.com
41-
scope: '@onelitefeathernet'
42-
43-
- run: pnpm install --frozen-lockfile
44-
45-
- run: pnpm publish --no-git-checks
46-
env:
47-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
uses: ./.github/workflows/publish.yml
27+
with:
28+
ref: ${{ needs.release-please.outputs.sha }}

0 commit comments

Comments
 (0)