Skip to content

Trigger canary release #15

Trigger canary release

Trigger canary release #15

Workflow file for this run

name: Release Canary
on:
pull_request:
types: [labeled]
branches: ["*"]
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
timeout-minutes: 10
runs-on: ubuntu-latest
permissions: write-all
if: contains(github.event.pull_request.labels.*.name, 'release canary')
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Node.js
uses: pnpm/action-setup@v4
with:
run_install: |
- recursive: true
args: [--no-frozen-lockfile]
- name: Publish a Canary version
id: publish
run: |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
pnpm changeset version --snapshot ${{ github.event.number }}
# npm publish --access public --tag canary --no-git-checks
echo "published=true" >> "$GITHUB_OUTPUT"
echo "version=$(npm pkg get version | sed -e 's/^"//;s/"$//')" >> "$GITHUB_OUTPUT"
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
- name: Comment on PR
if: steps.publish.outputs.published == 'true'
uses: actions/github-script@v3
with:
github-token: ${{ secrets.MY_GITHUB_TOKEN }}
script: |
const issue_number = context.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
github.issues.createComment({
issue_number,
owner,
repo,
body: `
🚀 A new Canary version has been released
You can install it by running:
\`\`\`bash
pnpm add eslint-plugin-rtl-friendly@${{ steps.publish.outputs.version }} -D
\`\`\`
`.split("\n")
.map(l => l.trim())
.join("\n")
})
github.issues.removeLabel({
issue_number,
owner,
repo,
name: 'release canary'
});
github.issues.addLabels({
issue_number,
owner,
repo,
labels: ['canary released']
});