This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
Update package.json #3
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
# This file's workflow invokes changesets to generate and publish a release. | |
# If pushing to the master branch, the changesets action is used to maintain a | |
# release-specific pull request, and trigger an actual release if that PR is | |
# merged. | |
# If pushing to develop, a snapshot release is published to the @develop tag | |
# instead. | |
name: Release | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
permissions: write-all | |
jobs: | |
# Run unit tests by calling the workflow in unit_tests.yml | |
unit_tests: | |
name: Unit tests | |
uses: ./.github/workflows/unit_tests.yml | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
# needs: unit_tests # Release step will ONLY run if unit tests complete. | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup (cache, dependencies) | |
uses: ./.github/actions/install_and_cache_dependencies | |
- name: Build | |
run: npm run build | |
# For stable branch, use changeset action to maintain a PR and finally | |
# publish when appropriate. | |
- name: Create release (or Pull Request) | |
if: github.ref_name == 'master' | |
uses: changesets/action@v1 | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
publish: npm run release | |
# Snapshot releases don't need the changeset action to put together PRs. | |
- name: Create snapshot release | |
if: github.ref_name == 'develop' | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo //registry.npmjs.org/:_authToken=${NPM_TOKEN} > .npmrc | |
npm run build | |
npx changeset version --snapshot develop | |
npx changeset publish --tag develop |