1
0
Fork 0
toolkit/.github/workflows/publish.yml

103 lines
2.4 KiB
YAML
Raw Normal View History

2024-01-26 19:07:41 +00:00
name: Publish
on:
workflow_dispatch:
inputs:
package:
2024-01-26 19:01:49 +00:00
description: The package to publish
required: true
2024-01-26 19:01:49 +00:00
type: choice
options:
- core
- artifact
- cache
- exec
- github
- glob
- http-client
- io
- tool-cache
jobs:
2024-01-26 19:01:49 +00:00
package:
name: Package Artifact
runs-on: macos-latest
steps:
2024-01-26 19:01:49 +00:00
- name: Checkout
id: checkout
uses: actions/checkout@v4
2024-01-26 19:01:49 +00:00
- name: Setup Node.js
id: setup-node
uses: actions/setup-node@v4
2021-12-07 15:38:25 +00:00
with:
2023-08-28 14:40:06 +00:00
node-version: 20.x
2024-01-26 19:01:49 +00:00
- name: Install Dependencies
id: install
run: npm install
2024-01-26 19:01:49 +00:00
- name: Bootstrap
id: bootstrap
run: npm run bootstrap
2024-01-26 19:01:49 +00:00
- name: Build
id: build
run: npm run build
2024-01-26 19:01:49 +00:00
- name: Test
id: test
run: npm run test
2024-01-26 19:01:49 +00:00
- name: Pack
id: pack
run: npm pack
working-directory: packages/${{ github.event.inputs.package }}
2024-01-26 19:01:49 +00:00
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.inputs.package }}
path: packages/${{ github.event.inputs.package }}/*.tgz
publish:
2024-01-26 19:01:49 +00:00
name: Publish Artifact
runs-on: macos-latest
2024-01-26 19:01:49 +00:00
needs:
- package
environment: npm-publish
2024-01-26 19:01:49 +00:00
steps:
- name: Download Artifact
id: download
uses: actions/download-artifact@v4
with:
name: ${{ github.event.inputs.package }}
2021-04-06 18:41:33 +00:00
2024-01-26 19:01:49 +00:00
- name: Configure Authentication
id: configure-auth
env:
NPM_TOKEN: ${{ secrets.TOKEN }}
2024-01-26 19:01:49 +00:00
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
2021-04-06 18:41:33 +00:00
2024-01-26 19:01:49 +00:00
- name: Publish to npm
id: publish
2021-04-06 18:41:33 +00:00
run: npm publish *.tgz
2024-01-26 19:01:49 +00:00
- if: failure()
name: (Failure) Notify Slack
env:
SLACK_WEBHOOK: ${{ secrets.SLACK }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Failed to publish a new version of ${{ github.event.inputs.package }}"}' $SLACK_WEBHOOK
2024-01-26 19:01:49 +00:00
- if: success()
name: (Success) Notify Slack
env:
SLACK_WEBHOOK: ${{ secrets.SLACK }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":":dance: Successfully published a new version of ${{ github.event.inputs.package }}"}' $SLACK_WEBHOOK