support new configuration option moduleNamingMode
#659
This file contains 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: Release snapshot | |
on: | |
issue_comment: | |
types: [created] | |
env: | |
npm-token: ${{ secrets.NPM_TOKEN }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
node-version: '22.x' | |
release-tag: pr${{ github.event.issue.number }}-run${{ github.run_number }}-${{ github.run_attempt }} | |
jobs: | |
release-check: | |
runs-on: ubuntu-22.04 | |
permissions: | |
pull-requests: write | |
outputs: | |
triggered: ${{ steps.check.outputs.triggered }} | |
steps: | |
- name: Acknowledge deployment request to commenter | |
id: check | |
uses: khan/pull-request-comment-trigger@v1.1.0 | |
with: | |
trigger: '/release-snapshot' | |
reaction: rocket | |
env: | |
GITHUB_TOKEN: ${{ env.github-token }} | |
- name: Validate user | |
if: ${{ steps.check.outputs.triggered == 'true' }} | |
run: | | |
if [[ "${AUTHOR_ASSOCIATION}" != 'OWNER' ]] | |
then | |
echo "User authorization failed" | |
exit 1 | |
else | |
echo "User authorization successful" | |
exit 0 | |
fi | |
env: | |
AUTHOR_ASSOCIATION: ${{ github.event.comment.author_association }} | |
- name: Report failure | |
if: failure() | |
uses: octokit/request-action@v2.3.0 | |
with: | |
route: POST /repos/{owner}/{repo}/issues/{issue_number}/comments | |
owner: ${{ github.repository_owner }} | |
repo: ${{ github.event.repository.name }} | |
issue_number: ${{ github.event.issue.number }} | |
body: '❌ No permission to release snapshot' | |
env: | |
GITHUB_TOKEN: ${{ env.github-token }} | |
release: | |
runs-on: ubuntu-22.04 | |
needs: release-check | |
permissions: | |
pull-requests: write | |
if: needs.release-check.outputs.triggered == 'true' | |
steps: | |
- name: Get Pull Request ref | |
id: get_pull_request_ref | |
uses: octokit/request-action@v2.3.0 | |
with: | |
route: GET /repos/{owner}/{repo}/pulls/{issue_number} | |
owner: ${{ github.repository_owner }} | |
repo: ${{ github.event.repository.name }} | |
issue_number: ${{ github.event.issue.number }} | |
env: | |
GITHUB_TOKEN: ${{ env.github-token }} | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: true | |
repository: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.repo.full_name }} | |
ref: ${{ fromJson(steps.get_pull_request_ref.outputs.data).head.ref }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.node-version }} | |
cache: yarn | |
cache-dependency-path: '**/yarn.lock' | |
- name: Install deps | |
run: yarn install --prefer-offline | |
- name: Configure NPM | |
run: | | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | |
env: | |
NPM_TOKEN: ${{ env.npm-token }} | |
- name: Deploy snapshot | |
run: | | |
yarn changeset version --snapshot $RELEASE_TAG | |
yarn nx run-many --target=build | |
yarn changeset publish --tag $RELEASE_TAG --no-git-tag | |
env: | |
GITHUB_TOKEN: ${{ env.github-token }} | |
RELEASE_TAG: ${{ env.release-tag }} | |
- name: Report success | |
if: success() | |
uses: octokit/request-action@v2.3.0 | |
with: | |
route: POST /repos/{owner}/{repo}/issues/{issue_number}/comments | |
owner: ${{ github.repository_owner }} | |
repo: ${{ github.event.repository.name }} | |
issue_number: ${{ github.event.issue.number }} | |
body: '✅ Successfully published package/s with tag `${{ env.release-tag }}`!' | |
env: | |
GITHUB_TOKEN: ${{ env.github-token }} | |
- name: Report failure | |
if: failure() | |
uses: octokit/request-action@v2.3.0 | |
with: | |
route: POST /repos/{owner}/{repo}/issues/{issue_number}/comments | |
owner: ${{ github.repository_owner }} | |
repo: ${{ github.event.repository.name }} | |
issue_number: ${{ github.event.issue.number }} | |
body: '❌ Failed to publish package/s with tag `${{ env.release-tag }}`' | |
env: | |
GITHUB_TOKEN: ${{ env.github-token }} |