Merge pull request #2798 from udecode/changeset-release/main #1365
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: Release | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
release: | |
name: Release and changelog | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@master | |
with: | |
# To run comparison we need more than the latest commit. Keep the fetch-depth relatively | |
# high or set it to zero to get all commits from the git repo. | |
# @link https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches | |
fetch-depth: 150 | |
- name: Use Node.js 16.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
# Why not using setup-node 2.2+ cache option (yet) ? | |
# see https://github.com/belgattitude/nextjs-monorepo-example/pull/369 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | |
- name: Restore yarn cache | |
uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: yarn-cache-folder-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} | |
restore-keys: | | |
yarn-cache-folder- | |
- name: Install Dependencies | |
run: YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn install | |
- name: Prepare Release | |
run: yarn prerelease | |
# https://github.com/changesets/action | |
- name: Create release pull request | |
uses: changesets/action@master | |
with: | |
publish: yarn changeset publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.X_GITHUB_CHANGESET_RELEASE_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |