This repository has been archived by the owner on Nov 5, 2023. It is now read-only.
Release Packages #94
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
# Release packages when the test workflow completes successfully using the changesets/action action. | |
# https://github.com/changesets/action | |
name: Release Packages | |
on: | |
workflow_run: | |
workflows: ['Test Packages'] | |
types: | |
- completed | |
branches: ['main'] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
release: | |
name: Release | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Restore Node.js modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ runner.arch }}-node-modules-${{ hashFiles('**/yarn.lock') }} | |
fail-on-cache-miss: true | |
- name: Create Release Pull Request | |
id: changesets | |
uses: changesets/action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Creating .npmrc | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
run: | | |
cat << EOF > "$HOME/.npmrc" | |
//registry.npmjs.org/:_authToken=$NPM_TOKEN | |
//npm.pkg.github.com/:_authToken=$GITHUB_TOKEN | |
EOF | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Cache Trubo | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
uses: actions/cache@v3 | |
with: | |
path: .turbo | |
key: ${{ runner.os }}-${{ runner.arch }}-turbo-test-${{ hashFiles('**/yarn.lock') }}-${{ github.sha }} | |
fail-on-cache-miss: true | |
- name: Yarn build | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
run: yarn release:build --cache-dir=.turbo | |
- name: Publish NPM | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
run: yarn release:publish | |
- name: Publish Github | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
run: yarn release:github-publish || true |