This repository has been archived by the owner on Dec 12, 2024. It is now read-only.
Fixed minor issue to prep v2.2.0 release (#270) #71
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 | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
release: | |
# prevents this action from running on forks | |
if: github.repository == 'TBD54566975/tbdex-js' | |
permissions: | |
contents: write # to create release (changesets/action) | |
pull-requests: write # to create pull request (changesets/action) | |
id-token: write # necessary for NPM provenance | |
name: Release | |
runs-on: ubuntu-latest | |
outputs: | |
published: ${{ steps.changesets.outputs.published }} | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
with: | |
submodules: "true" | |
# https://cashapp.github.io/hermit/usage/ci/ | |
- name: Init Hermit | |
uses: cashapp/activate-hermit@v1 | |
- name: Store NPM Registry Settings to .npmrc | |
run: | | |
echo -e "//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}" > ~/.npmrc | |
- name: Verify NPM token is authenticated with NPMjs.com | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: pnpm whoami | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build all workspace packages | |
run: pnpm build | |
- name: Create Release Pull Request or Publish to npm | |
uses: changesets/action@v1 | |
id: changesets | |
with: | |
publish: pnpm changeset publish | |
version: pnpm changeset version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish `next` preview | |
if: steps.changesets.outputs.published != 'true' && steps.changesets.outputs.pullRequestNumber != '' && steps.changesets.outputs.hasChangesets == 'true' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
git checkout main | |
SHORT_SHA=$(git rev-parse --short HEAD) | |
pnpm changeset version --snapshot next-$SHORT_SHA | |
pnpm changeset publish --no-git-tag --tag next | |
publish-docs: | |
needs: release | |
name: Publish Docs | |
if: ${{ needs.release.outputs.published == 'true' }} | |
uses: ./.github/workflows/docs-publish.yml |