Merge pull request #9 from lobor/changeset-release/main #4
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 | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- uses: pnpm/action-setup@v2 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install Dependencies | |
run: pnpm install --frozen-lock | |
- name: Create Release Pull Request or Tag release to github | |
id: changesets | |
uses: changesets/action@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build packages | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
run: pnpm build | |
- name: Publish to NPM | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: pnpm changeset publish --tag | |
- name: Build documentation site | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
run: pnpm -F crossed-docs build | |
- name: Setup Pages | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
uses: actions/configure-pages@v1 | |
- name: Upload documentation artifact | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./apps/docs/out | |
- name: Deploy documentation to GitHub Pages | |
if: steps.changesets.outputs.hasChangesets == 'false' | |
id: deployment | |
uses: actions/deploy-pages@v1 |