Skip to content

cleanup code, use href() type safe routing (#446) #183

cleanup code, use href() type safe routing (#446)

cleanup code, use href() type safe routing (#446) #183

Workflow file for this run

name: npmjs
on:
push:
branches:
- main
permissions:
actions: write
contents: write
pull-requests: write
jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'ngrok-oss/mantle'
env:
DO_NOT_TRACK: 1
TURBO_TELEMETRY_DISABLED: 1
VERCEL_TELEMETRY_DISABLED: 1
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
steps:
- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Install pnpm 📦
uses: pnpm/action-setup@v4
# use version from package.json#packageManager field
with:
run_install: false
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"
- name: Install Dependencies 📥
run: |
pnpm install
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm -w changeset:publish
version: pnpm -w changeset:version
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Extract MANTLE_VERSION
if: steps.changesets.outputs.published == 'true'
run: |
echo "Extracting MANTLE_VERSION..."
VERSION=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[0].version')
echo "MANTLE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Post to slack
if: steps.changesets.outputs.published == 'true'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PUBLISH_WEBHOOK_URL }}
MANTLE_VERSION: ${{ env.MANTLE_VERSION }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":"`@ngrok/mantle@${{ env.MANTLE_VERSION }}` published to npm!\nInstall with: `pnpm add -E @ngrok/mantle@${{ env.MANTLE_VERSION }}`\n<https://github.com/ngrok-oss/mantle/releases/tag/%40ngrok%2Fmantle%40${{ env.MANTLE_VERSION }}|Release Notes>"}' $SLACK_WEBHOOK_URL