KIT-93: [react-kit] <Footer />
component
#26
Workflow file for this run
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: Snapshot Release | |
on: | |
push: | |
branches: | |
- feat/* | |
pull_request: | |
branches: | |
- feat/* | |
permissions: read-all | |
jobs: | |
snapshot_release: | |
name: Snapshot Release | |
runs-on: ubuntu-latest | |
steps: | |
# ensure the github.actor is a member of the team to prevent unauthorized releases | |
- name: Check for authorized user | |
uses: tspascoal/get-user-teams-membership@v3 | |
id: check-authorization | |
with: | |
username: ${{ github.actor }} | |
team: ${{ vars.TEAM_NAME }} | |
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
- name: Fail if not authorized | |
if: steps.check-authorization.outputs.isTeamMember == 'false' | |
run: exit 1 | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup node and pmpm | |
uses: ./.github/actions/setup-node | |
with: | |
pnpm: 'true' | |
# there is no action for snapshot releases so we need to add the npm token and run the commands manually | |
- name: Append npm token to .npmrc | |
run: | | |
cat << EOF > "$HOME/.npmrc" | |
//registry.npmjs.org/:_authToken=$NPM_TOKEN | |
EOF | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# https://github.com/changesets/changesets/issues/1195 | |
# Snapshots won't work in pre mode so we exit pre mode | |
- name: Exit pre mode | |
run: pnpm changeset pre exit | |
- name: Version and publish snapshot release | |
id: version-and-publish | |
run: | | |
echo "tag_name=$(basename ${{ github.head_ref || github.ref_name }})" >> $GITHUB_OUTPUT | |
pnpm changeset version --snapshot $(basename ${{ github.head_ref || github.ref_name }}) | |
pnpm build:cli | |
pnpm changeset publish --snapshot --no-git-tag --tag $(basename ${{ github.head_ref || github.ref_name }}) | |
- name: Send Slack success message | |
if: success() | |
id: slack-success | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "header", | |
"text": { | |
"type": "plain_text", | |
"text": "${{ github.workflow }} Succeeded :large_green_circle:", | |
"emoji": true | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "plain_text", | |
"text": "${{ steps.version-and-publish.outputs.tag_name }}" | |
} | |
}, | |
{ | |
"type": "actions", | |
"elements": [ | |
{ | |
"type": "button", | |
"action_id": "basic_success_view", | |
"text": { | |
"type": "plain_text", | |
"text": "View Job" | |
}, | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
} | |
] | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
- name: Send Slack failure message | |
if: failure() | |
id: slack-failure | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "header", | |
"text": { | |
"type": "plain_text", | |
"text": "${{ github.workflow }} Failed :red_circle:", | |
"emoji": true | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "plain_text", | |
"text": "${{ github.ref }}" | |
} | |
}, | |
{ | |
"type": "actions", | |
"elements": [ | |
{ | |
"type": "button", | |
"action_id": "basic_failure_view", | |
"text": { | |
"type": "plain_text", | |
"text": "View Job" | |
}, | |
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
} | |
] | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |