v0.0.67 #100
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: Publish | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
- name: pnpm 🧰 | |
uses: pnpm/[email protected] | |
with: | |
version: 7 | |
- name: Node 🧰 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: 'pnpm' | |
- name: Install 📦 | |
run: pnpm install | |
- name: Build elements 🛠 | |
run: pnpm build:elements | |
- name: Build elements-hook-form 🛠 | |
run: pnpm build:elements-hook-form | |
- name: Publish 🚀 PRERELEASE | |
if: 'github.event.release.prerelease' | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
pnpm -r publish --tag next --no-git-checks --access restricted | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish 🚀 PRODUCTION | |
if: '!github.event.release.prerelease' | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
pnpm -r publish --no-git-checks --access restricted | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Trigger deploy to gh-pages 🚀 | |
# if: '!github.event.release.prerelease' | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.COMMERCELAYER_CI_TOKEN }} | |
script: | | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: context.ref, | |
workflow_id: 'gh-pages.yaml' | |
}); | |
- name: Post to a Slack channel | |
id: slack | |
uses: slackapi/[email protected] | |
with: | |
# Slack channel id, channel name, or user id to post message. | |
# See also: https://api.slack.com/methods/chat.postMessage#channels | |
# channel-id: 'pipeline' | |
# For posting a rich message using Block Kit | |
payload: | | |
{ | |
"text": "New release ${{github.ref_name}} for ${{github.event.repository.name}}.", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "New release for <${{github.event.repository.html_url}}|`${{github.event.repository.name}}`>\n*<${{github.event.release.html_url}}|release notes>*" | |
} | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Project:*\n${{github.event.repository.name}}" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Version:*\n${{github.ref_name}}" | |
} | |
] | |
}, | |
{ | |
"type": "context", | |
"elements": [ | |
{ | |
"type": "image", | |
"image_url": "${{github.event.sender.avatar_url}}", | |
"alt_text": "${{github.event.sender.login}}" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*${{github.event.sender.login}}* has triggered this release." | |
} | |
] | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.PIPELINE_SLACK_CHANNEL_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |