Skip to content

Commit 417163f

Browse files
authored
Generate an edge release when stable releases are created. (#46)
1 parent e251f6f commit 417163f

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/release.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
env:
1313
TERM: xterm
14-
PRERELEASE_TAG: edge
1514
strategy:
1615
matrix:
1716
os:
1817
- ubuntu-24.04
1918
node-version:
20-
- '18'
19+
- '20'
2120
steps:
2221
# Install deps and cache
2322
- name: Checkout code
@@ -33,9 +32,9 @@ jobs:
3332

3433
# Let's do tests rq just to make sure we dont push something that is fundamentally broken
3534
- name: Lint code
36-
run: yarn lint
35+
run: npm run lint
3736
- name: Run unit tests
38-
run: yarn test:unit
37+
run: npm run test:unit
3938

4039
# Prepare release.
4140
- name: Prepare release
@@ -49,14 +48,23 @@ jobs:
4948
# Deploy
5049
- name: Publish to npm
5150
run: |
51+
VERSION=$(node -p "require('./package.json').version")
52+
PACKAGE=$(node -p "require('./package.json').name")
53+
5254
if [ "${{ github.event.release.prerelease }}" == "false" ]; then
5355
npm publish --access public --dry-run
5456
npm publish --access public
55-
echo "::notice title=Published ${{ github.ref_name }} to @${{ github.repository }}::This is a stable release published to the default 'latest' npm tag"
57+
npm dist-tag add "$PACKAGE@$VERSION" edge
58+
59+
echo "::notice title=Published $VERSION to $PACKAGE::This is a stable release published to the default 'latest' npm tag"
60+
echo "::notice title=Updated latest tag to $VERSION::The stable tag now points to $VERSION"
61+
echo "::notice title=Updated edge tag to $VERSION::The edge tag now points to $VERSION"
5662
else
57-
npm publish --access public --tag ${{ env.PRERELEASE_TAG }} --dry-run
58-
npm publish --access public --tag ${{ env.PRERELEASE_TAG }}
59-
echo "::notice title=Published ${{ github.ref_name }} to @${{ github.repository }}@${{ env.PRERELEASE_TAG }}::This is a pre-release published to the '${{ env.PRERELEASE_TAG }}' npm tag"
63+
npm publish --access public --tag edge --dry-run
64+
npm publish --access public --tag edge
65+
66+
echo "::notice title=Published $VERSION to $PACKAGE::This is a prerelease published to the 'edge' npm tag"
67+
echo "::notice title=Updated edge tag to $VERSION::The edge tag now points to $VERSION"
6068
fi
6169
env:
6270
NODE_AUTH_TOKEN: ${{secrets.NPM_DEPLOY_TOKEN}}

0 commit comments

Comments
 (0)