hot-carrots-brush #140
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: 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: | |
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 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
registry-url: "https://registry.npmjs.org" | |
- name: Install pnpm 📦 | |
uses: pnpm/action-setup@v4 | |
# use version from package.json#packageManager field | |
- 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: Post to slack | |
if: steps.changesets.outputs.published == 'true' | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_PUBLISH_WEBHOOK_URL }} | |
run: | | |
MANTLE_VERSION=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[0].version') | |
curl -X POST -H 'Content-type: application/json' --data '{"text":"`@ngrok/mantle@$MANTLE_VERSION` published to npm!\nInstall with: `pnpm add -E @ngrok/mantle@$MANTLE_VERSION`\n<https://github.com/ngrok-oss/mantle/releases/tag/v$MANTLE_VERSION|Release Notes>"}' $SLACK_WEBHOOK_URL |