feat: update package manager versions (#492) #223
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish releases | |
on: | |
push: | |
branches: [main] | |
env: | |
YARN_ENABLE_GLOBAL_CACHE: false | |
jobs: | |
release-please: | |
runs-on: ubuntu-latest | |
outputs: | |
release_created: ${{ steps.release.outputs.release_created }} | |
release_tag: ${{ steps.release.outputs.tag_name }} | |
steps: | |
- uses: google-github-actions/release-please-action@v3 | |
id: release | |
with: | |
release-type: node | |
package-name: corepack | |
bump-minor-pre-major: true # TODO: remove this when releasing v1.0.0. | |
npm-publish: | |
needs: release-please | |
if: ${{ needs.release-please.outputs.release_created }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Get the Yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
shell: bash | |
- uses: actions/cache@v4 | |
with: | |
path: ${{steps.yarn-cache-dir-path.outputs.dir}} | |
key: ${{runner.os}}-yarn-${{hashFiles('**/yarn.lock')}} | |
restore-keys: | | |
${{runner.os}}-yarn- | |
- run: corepack yarn install --immutable | |
- run: corepack yarn pack --out corepack.tgz | |
- name: Publish to the npm registry | |
run: npm publish corepack.tgz --provenance | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
- name: Add Corepack package archive to GitHub release | |
run: gh release upload ${{ needs.release-please.outputs.release_tag }} corepack.tgz | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |