diff --git a/.github/workflows/release-on-npm.yaml b/.github/workflows/release-on-npm.yaml new file mode 100644 index 00000000000..8df7dde7775 --- /dev/null +++ b/.github/workflows/release-on-npm.yaml @@ -0,0 +1,50 @@ +name: Release on NPM + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: 2.x + + - name: Configure Git + run: | + git config --global user.email "" + git config --global user.name "Symfony" + + - name: Extract version from tag + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV + + - run: corepack enable + - uses: actions/setup-node@v4 + with: + cache: 'yarn' + cache-dependency-path: | + yarn.lock + package.json + src/**/package.json + - run: yarn --immutable + + - name: Update version of JS packages + run: yarn workspaces foreach -A version --immediate "${{ env.VERSION }}" + + - name: Commit changes + run: | + git add . + git commit -m "Update versions to ${{ env.VERSION }}" + + - name: Publish on NPM + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} + run: yarn workspaces foreach -A --no-private npm publish --access public --tolerate-republish + + - name: Push changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: git push origin 2.x diff --git a/.yarnrc.yml b/.yarnrc.yml index 3186f3f0795..ec300bf8a31 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -1 +1,2 @@ nodeLinker: node-modules +npmAuthToken: ${NPM_AUTH_TOKEN-}