Skip to content

Merge pull request #343 from VirtualLiveLab/changeset-release/main #328

Merge pull request #343 from VirtualLiveLab/changeset-release/main

Merge pull request #343 from VirtualLiveLab/changeset-release/main #328

Workflow file for this run

name: Release
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
release:
name: Test and Release (Release)
if: github.repository == 'VirtualLiveLab/js-config'
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
id-token: write
contents: write
packages: write
pull-requests: write
issues: read
steps:
- name: Create GitHub App Token
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
id: app-token
with:
app-id: ${{ vars.ACTIONS_MIKU_APP_ID }}
private-key: ${{ secrets.ACTIONS_MIKU_PRIVATE_KEY }}
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ steps.app-token.outputs.token }}
- name: Configure Git Identity
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
- name: Setup Node.js and pnpm
uses: ./.github/common/setup-node-pnpm
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@c8bada60c408975afd1a20b3db81d6eee6789308 # v1.4.9
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: pnpm release
setupGitUser: false
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Label PR if not published
if: steps.changesets.outputs.published != 'true' && steps.changesets.outputs.hasChangesets == 'true'
run: gh pr edit ${{ steps.changesets.outputs.pullRequestNumber }} --add-label "release"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}