Skip to content

fix env

fix env #19

Workflow file for this run

name: Release
on:
push:
branches:
- main
pull_request:
types: [labeled, unlabeled]
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'
# only executes this job if its a push to main or
# a labeled pull request from a branch named: changeset-release/main
if: >
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
(github.event_name == 'pull_request' &&
github.head_ref == 'changeset-release/main' &&
(github.event.action == 'labeled' ||
github.event.action == 'unlabeled'))
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
environment: ${{ (github.event_name == 'pull_request' && github.base_ref) || github.ref }}
outputs:
published: ${{ steps.changesets.outputs.published }}
steps:
- name: debug stuff
run: |
echo "GITHUB_REF: ${{ github.ref }}"
echo "GITHUB_HEAD_REF: ${{ github.head_ref }}"
echo "GITHUB_BASE_REF: ${{ github.base_ref }}"
echo "GITHUB_EVENT_ACTION: ${{ github.event.action }}"
- name: Checkout source
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
with:
ref: main
- name: Set up Node.js
uses: actions/setup-node@5ef044f9d09786428e6e895be6be17937becee3a #v4.0.0
with:
node-version: 18
registry-url: https://registry.npmjs.org/
cache: "npm"
- name: Verify NPM token is authenticated with NPMjs.com
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm whoami
- name: Install dependencies
run: npm ci
- name: Build all workspace packages
run: npm run build
- name: Create Release Pull Request or Publish to npm
uses: changesets/action@f13b1baaa620fde937751f5d2c3572b9da32af23 # v1.4.5
id: changesets
with:
publish: npx changeset publish
version: scripts/changesets-version.sh
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
npx changeset version --snapshot next
npx 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