Skip to content

chore: update fathom-client #830

chore: update fathom-client

chore: update fathom-client #830

Workflow file for this run

name: Canary Release
on:
workflow_call:
secrets:
CHANGESETS_PAT:
required: true
NPM_TOKEN:
required: true
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
jobs:
release-canary:
name: Release Canary
runs-on: ubuntu-latest
if: contains( github.event.pull_request.labels.*.name, 'release:canary')
steps:
- name: Checkout Repo
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
fetch-depth: 0
- name: Setup Node.js 16.x
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # v3.7.0
with:
node-version: 16.x
- name: Install Dependencies
run: npm ci
- name: Version
run: npx changeset version --snapshot canary
env:
GITHUB_TOKEN: ${{ secrets.CHANGESETS_PAT }}
- name: Publish Canary Packages
id: changesets
uses: changesets/action@f13b1baaa620fde937751f5d2c3572b9da32af23 # v1.4.5
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: npm run release:canary
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.CHANGESETS_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Compute new packages info
id: packagesData
if: success() && steps.changesets.outputs.published == 'true'
# We're using the special GH Actions syntax to add step outputs (ref: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-output-parameter)
# for count: use jq to determine the length of the array
# for packageList: use jq reduce to build up a string of markdown (ref: https://stedolan.github.io/jq/manual/#Reduce)
run: |
echo "::set-output name=count::$(echo ${{toJson(steps.changesets.outputs.publishedPackages)}} | jq '. | length')"
echo "::set-output name=packageList::$(echo ${{toJson(steps.changesets.outputs.publishedPackages)}} | jq 'reduce .[] as $item (""; . + "#### \($item.name)@\($item.version)\n```\nnpm install \($item.name)@canary\n```\n")')"
- name: Comment
uses: marocchino/sticky-pull-request-comment@f61b6cf21ef2fcc468f4345cdfcc9bda741d2343 # v2.6.2
if: success() && steps.changesets.outputs.published == 'true'
with:
header: 'canary-release'
message: |
### :package: Canary Packages Published
Latest commit: ${{ github.event.pull_request.head.sha }}
<details><summary>Published ${{ steps.packagesData.outputs.count }} packages</summary>
${{ fromJSON(steps.packagesData.outputs.packageList) }}
</details>