ci: release package (#81) #79
This file contains hidden or 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: Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| release: | |
| name: Version or Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| packages: write | |
| id-token: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup environment | |
| uses: ./.github/actions/setup-ci-env | |
| with: | |
| install-deps: true | |
| node-version: lts/* | |
| - name: Build artifacts | |
| run: npm run build | |
| - name: Create Release Pull Request or Publish | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| version: npm run changeset -- version | |
| publish: npm run changeset -- publish | |
| commit: "ci: release package" | |
| title: "[CI] Release Package" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.ADOBE_BOT_NPM_TOKEN }} | |
| - name: Generate Slack Announcement | |
| id: announcement | |
| if: steps.changesets.outputs.published == 'true' | |
| run: | | |
| # From Node v22.18.0, the node command is able to run .ts files directly (if it only needs type stripping). | |
| # As of August 2025, Node v22.18.0 is already LTS (the version used by this workflow). | |
| SLACK_WEBHOOK_PAYLOAD="$(node .github/scripts/announce.ts '${{ steps.changesets.outputs.publishedPackages }}')" | |
| echo "SLACK_WEBHOOK_PAYLOAD=$SLACK_WEBHOOK_PAYLOAD" >> "$GITHUB_OUTPUT" | |
| - name: Notify on Slack | |
| uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1 | |
| if: steps.changesets.outputs.published == 'true' | |
| with: | |
| webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| webhook-type: incoming-webhook | |
| payload: ${{ steps.announcement.outputs.SLACK_WEBHOOK_PAYLOAD }} |