Improve version metadata binding detection (#125) #46
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 | |
jobs: | |
release: | |
name: Release | |
timeout-minutes: 30 | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
if: github.repository_owner == 'evanderkoogh' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: 'Install NPM Dependencies' | |
run: 'pnpm install --frozen-lockfile --child-concurrency=10' | |
- name: Check the build | |
run: pnpm build | |
- name: 'Check for Errors' | |
run: 'pnpm check' | |
- name: Create Release Pull Request or Publish to npm | |
id: changesets | |
uses: changesets/action@v1 | |
with: | |
publish: pnpm release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Update NPM Tags | |
# Changesets does not publish RC as latest. This will | |
# tag RC to latest until we get to a stable release. | |
if: steps.changesets.outputs.published == 'true' | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
set -eux | |
PUBLISHED_VERSION=$(echo '${{ steps.changesets.outputs.publishedPackages }}' \ | |
| jq -er '[.[] | select(.name=="@microlabs/otel-cf-workers")][0].version') | |
npm dist-tag add @microlabs/otel-cf-workers@${PUBLISHED_VERSION} latest |