Skip to content

Commit 47931f5

Browse files
committed
minor #2615 [CI] Add workflow to automatically publish JS packages on npm (Kocal)
This PR was merged into the 2.x branch. Discussion ---------- [CI] Add workflow to automatically publish JS packages on npm | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT <!-- Replace this notice by a description of your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - For new features, provide some code snippets to help understand usage. - Features and deprecations must be submitted against branch main. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Follow #2614 Commits ------- 0092773 [CI] Add workflow to automatically publish JS packages on npm
2 parents 107d882 + 0092773 commit 47931f5

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/workflows/release-on-npm.yaml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release on NPM
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
ref: 2.x
15+
16+
- name: Configure Git
17+
run: |
18+
git config --global user.email ""
19+
git config --global user.name "Symfony"
20+
21+
- name: Extract version from tag
22+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
23+
24+
- run: corepack enable
25+
- uses: actions/setup-node@v4
26+
with:
27+
cache: 'yarn'
28+
cache-dependency-path: |
29+
yarn.lock
30+
package.json
31+
src/**/package.json
32+
- run: yarn --immutable
33+
34+
- name: Update version of JS packages
35+
run: yarn workspaces foreach -A version --immediate "${{ env.VERSION }}"
36+
37+
- name: Commit changes
38+
run: |
39+
git add .
40+
git commit -m "Update versions to ${{ env.VERSION }}"
41+
42+
- name: Publish on NPM
43+
env:
44+
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
45+
run: yarn workspaces foreach -A --no-private npm publish --access public --tolerate-republish
46+
47+
- name: Push changes
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
run: git push origin 2.x

.yarnrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
nodeLinker: node-modules
2+
npmAuthToken: ${NPM_AUTH_TOKEN-}

0 commit comments

Comments
 (0)