Skip to content

chore: publish new release #73

chore: publish new release

chore: publish new release #73

Workflow file for this run

name: Publish
on:
pull_request:
types:
- closed
branches:
- main
jobs:
publish:
if: github.event.pull_request.merged == true && github.head_ref == 'changeset-release/main'
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
cache: pnpm
- name: Install dependencies
run: pnpm install
- name: Publish
uses: changesets/action@v1
id: changesets
with:
version: pnpm version
publish: pnpm tag
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Plan container images to publish
id: containers
run: |
possible_targets=$(pnpm nx show projects -t container --json)
published_packages='${{ steps.changesets.outputs.publishedPackages }}'
targets=$(echo $published_packages | jq --argjson possible_targets "$possible_targets" 'map(select(.name == $possible_targets[]))')
targets_string=$(echo $targets | jq -r tostring)
echo "containers=$targets_string" >> $GITHUB_OUTPUT
outputs:
published: ${{ steps.changesets.outputs.published }}
publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
containers: ${{ steps.containers.outputs.containers }}
deploy-to-registries:
name: Deploy to registries
uses: ./.github/workflows/cd-registries.yaml
needs: publish
with:
publishedPackages: ${{ needs.publish.outputs.publishedPackages }}
containers: ${{ needs.publish.outputs.containers }}
secrets: inherit
if: ${{ needs.publish.outputs.published }}