Skip to content

Commit f3be573

Browse files
committed
chore: fix release
1 parent b0b0f33 commit f3be573

File tree

1 file changed

+88
-43
lines changed

1 file changed

+88
-43
lines changed

.github/workflows/release.yml

Lines changed: 88 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,80 +21,125 @@ on:
2121
- 'yes'
2222
- 'no'
2323

24-
permissions:
25-
contents: read
26-
id-token: write
27-
2824
jobs:
29-
build_stencil_jest_runner:
25+
build:
3026
name: Build
31-
uses: ./.github/workflows/build.yml
32-
33-
get_dev_version:
34-
if: inputs.devRelease == 'yes'
35-
name: Get Dev Build Version
3627
runs-on: ubuntu-latest
37-
outputs:
38-
dev-version: ${{ steps.generate-dev-version.outputs.DEV_VERSION }}
3928
steps:
4029
- name: Checkout Code
4130
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4231

43-
- name: Generate Dev Version
44-
id: generate-dev-version
45-
run: |
46-
PKG_JSON_VERSION=$(cat package.json | jq -r '.version')
47-
GIT_HASH=$(git rev-parse --short HEAD)
32+
- name: Setup pnpm
33+
uses: pnpm/action-setup@v4
4834

49-
# A unique string to publish Stencil Jest Runner under
50-
# e.g. "2.1.0-dev.1677185104.7c87e34"
51-
DEV_VERSION=$PKG_JSON_VERSION-dev.$(date +"%s").$GIT_HASH
35+
- name: Setup Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: 22.x
39+
cache: 'pnpm'
5240

53-
echo "Using version $DEV_VERSION"
41+
- name: Install dependencies
42+
run: pnpm install --frozen-lockfile
5443

55-
# store a key/value pair in GITHUB_OUTPUT
56-
# e.g. "DEV_VERSION=2.1.0-dev.1677185104.7c87e34"
57-
echo "DEV_VERSION=$DEV_VERSION" >> $GITHUB_OUTPUT
58-
shell: bash
44+
- name: Build
45+
run: pnpm run build
5946

60-
dev_release_stencil_jest_runner:
47+
- name: Upload build artifacts
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: dist
51+
path: dist/
52+
53+
release-dev:
6154
if: inputs.devRelease == 'yes'
6255
name: Publish Dev Build
63-
needs: [build_stencil_jest_runner, get_dev_version]
56+
needs: build
6457
runs-on: ubuntu-latest
6558
permissions:
6659
id-token: write
6760
steps:
6861
- name: Checkout Code
6962
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
7063

71-
- name: Download Build Archive
72-
uses: stenciljs/.github/actions/download-archive@main
64+
- name: Download build artifacts
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: dist
68+
path: dist/
69+
70+
- name: Setup pnpm
71+
uses: pnpm/action-setup@v4
7372

74-
- uses: stenciljs/.github/actions/publish-npm@main
73+
- name: Setup Node.js
74+
uses: actions/setup-node@v4
7575
with:
76-
tag: dev
77-
skip-setup: 'yes'
78-
version: ${{ needs.get_dev_version.outputs.dev-version }}
76+
node-version: 22.x
77+
registry-url: 'https://registry.npmjs.org'
78+
79+
- name: Generate dev version
80+
id: version
81+
run: |
82+
PKG_VERSION=$(jq -r '.version' package.json)
83+
GIT_HASH=$(git rev-parse --short HEAD)
84+
DEV_VERSION="${PKG_VERSION}-dev.$(date +%s).${GIT_HASH}"
85+
echo "version=${DEV_VERSION}" >> $GITHUB_OUTPUT
86+
echo "Publishing dev version: ${DEV_VERSION}"
7987
80-
prod_release_stencil_jest_runner:
88+
- name: Set dev version
89+
run: npm version ${{ steps.version.outputs.version }} --no-git-tag-version
90+
91+
- name: Publish to npm
92+
run: npm publish --tag dev --provenance --access public
93+
94+
release-prod:
8195
if: inputs.devRelease == 'no'
82-
name: Publish Stencil Jest Runner
83-
needs: [build_stencil_jest_runner]
96+
name: Publish Production Release
97+
needs: build
8498
runs-on: ubuntu-latest
8599
permissions:
86100
contents: write
87101
id-token: write
88102
steps:
89103
- name: Checkout Code
90104
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
105+
with:
106+
fetch-depth: 0
107+
108+
- name: Download build artifacts
109+
uses: actions/download-artifact@v4
110+
with:
111+
name: dist
112+
path: dist/
113+
114+
- name: Setup pnpm
115+
uses: pnpm/action-setup@v4
116+
117+
- name: Setup Node.js
118+
uses: actions/setup-node@v4
119+
with:
120+
node-version: 22.x
121+
registry-url: 'https://registry.npmjs.org'
122+
123+
- name: Configure git
124+
run: |
125+
git config user.name "github-actions[bot]"
126+
git config user.email "github-actions[bot]@users.noreply.github.com"
127+
128+
- name: Bump version
129+
id: version
130+
run: |
131+
npm version ${{ inputs.releaseType }} -m "v%s"
132+
echo "version=$(jq -r '.version' package.json)" >> $GITHUB_OUTPUT
133+
134+
- name: Push version commit and tag
135+
run: git push --follow-tags
91136

92-
- name: Download Build Archive
93-
uses: stenciljs/.github/actions/download-archive@main
137+
- name: Publish to npm
138+
run: npm publish --tag latest --provenance --access public
94139

95-
- uses: stenciljs/.github/actions/publish-npm@main
140+
- name: Create GitHub Release
141+
uses: softprops/action-gh-release@v2
96142
with:
97-
tag: latest
98-
skip-setup: 'yes'
99-
version: ${{ inputs.releaseType }}
100-
github-token: ${{ secrets.GH_ADMIN_PAT }}
143+
tag_name: v${{ steps.version.outputs.version }}
144+
name: v${{ steps.version.outputs.version }}
145+
generate_release_notes: true

0 commit comments

Comments
 (0)