Skip to content

Commit 5c43a60

Browse files
committed
Fix release process
1 parent 854a58e commit 5c43a60

File tree

4 files changed

+64
-73
lines changed

4 files changed

+64
-73
lines changed

.github/workflows/integrate.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release
2+
3+
on:
4+
# This job runs when a new release is published
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
10+
publish:
11+
name: Publish to NPM
12+
runs-on: ubuntu-latest
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Retrieve dependencies from cache
20+
uses: actions/cache@v4
21+
id: cacheNpm
22+
with:
23+
path: |
24+
~/.npm
25+
node_modules
26+
key: npm-v22-${{ runner.os }}-refs/heads/main-${{ hashFiles('package.json') }}
27+
28+
- name: Install Node.js and npm
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 22.x
32+
registry-url: https://registry.npmjs.org
33+
34+
# Normally we have a guarantee that deps are already there, still it may not be the case when:
35+
# - `main` build for same commit failed (and we still pushed tag manually)
36+
# - We've pushed tag manually before `main` build finalized
37+
- name: Install dependencies
38+
if: steps.cacheNpm.outputs.cache-hit != 'true'
39+
run: |
40+
npm update --no-save
41+
npm update --save-dev --no-save
42+
43+
# Store the name of the release
44+
# See https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
45+
- run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
46+
47+
- run: npm version $RELEASE_VERSION --no-git-tag-version
48+
49+
- name: Publish new version
50+
# Note: Setting NODE_AUTH_TOKEN as job|workspace wide env var won't work
51+
# as it appears actions/setup-node sets own value
52+
env:
53+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54+
run: npm publish --access public --tag=latest

.github/workflows/validate.yml renamed to .github/workflows/tests.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
# PR's only
2-
3-
name: Validate
1+
name: Tests
42

53
on:
4+
push:
65
pull_request:
7-
branches: [main]
86

97
env:
108
FORCE_COLOR: 1
119

1210
jobs:
1311
linuxNode16:
14-
name: '[Linux] Node.js 16: Unit tests'
12+
name: '[Linux] [Node 16] Tests'
1513
runs-on: ubuntu-latest
1614
steps:
1715
- name: Checkout repository
@@ -25,9 +23,7 @@ jobs:
2523
~/.npm
2624
node_modules
2725
key: npm-v16-${{ runner.os }}-${{ github.ref }}-${{ hashFiles('package.json') }}
28-
restore-keys: |
29-
npm-v16-${{ runner.os }}-${{ github.ref }}-
30-
npm-v16-${{ runner.os }}-refs/heads/main-
26+
restore-keys: npm-v16-${{ runner.os }}-${{ github.ref }}-
3127

3228
- name: Install Node.js and npm
3329
uses: actions/setup-node@v1

.npmignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/.github
2+
/.editorconfig
3+
/.prettierignore
4+
/prettier.config.js
5+
/scripts/pkg
6+
/test

0 commit comments

Comments
 (0)