-
Notifications
You must be signed in to change notification settings - Fork 28
115 lines (101 loc) · 3.82 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Publish Packages
on:
workflow_dispatch:
inputs:
publishFlag:
description: 'which version to publish eg: alpha, latest'
required: true
default: 'alpha'
type: choice
options:
- alpha
- latest
repository_dispatch:
types: [publish-command]
jobs:
publish_packages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Check for main branch if latest
if: (github.event.inputs.publishFlag == 'latest' || github.event.client_payload.slash_command.args.unnamed.arg1 == 'latest') && github.ref_name != 'main'
run: exit 1
- name: Notify slack starting
if: github.event.inputs.publishFlag == 'latest' && success()
id: slack # IMPORTANT: reference this step ID value in future Slack steps
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_DEPLOY_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel_id: ${{ secrets.SLACK_DEPLOY_PROD_CHANNEL_ID }}
status: Start
color: warning
- name: Install packages
run: yarn install
- name: Test
run: yarn test
- name: Configure Git user
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
- name: Notify slack publish
if: github.event.inputs.publishFlag == 'latest' && success()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_DEPLOY_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
message_id: ${{ steps.slack.outputs.message_id }}
channel_id: ${{ secrets.SLACK_DEPLOY_PROD_CHANNEL_ID }}
status: Publishing
color: "#bada55"
# from-package will publish whatever version is present in each package's package.json
# it will not publish if the version is already published in npm
- name: Publish
run: yarn lerna:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PUBLISH_FLAG: ${{ github.event.inputs.publishFlag || github.event.client_payload.slash_command.args.unnamed.arg1 || 'alpha' }}
- name: Delay for 15s
run: sleep 15
- name: Notify slack success
if: github.event.inputs.publishFlag == 'latest' && success()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_DEPLOY_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
message_id: ${{ steps.slack.outputs.message_id }}
channel_id: ${{ secrets.SLACK_DEPLOY_PROD_CHANNEL_ID }}
status: Success
color: good
- name: Notify slack fail
if: github.event.inputs.publishFlag == 'latest' && failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_DEPLOY_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
message_id: ${{ steps.slack.outputs.message_id }}
channel_id: ${{ secrets.SLACK_DEPLOY_PROD_CHANNEL_ID }}
status: Failed
color: danger
run_api_reference:
needs: publish_packages
if: github.event.inputs.publishFlag == 'latest'
uses: ./.github/workflows/generate-docs.yml
secrets:
DOCKER_GIT_TOKEN: ${{ secrets.DOCKER_GIT_TOKEN}}
notify_100ms_links:
runs-on: ubuntu-latest
needs: publish_packages
steps:
- name: Repository Dispatch
if: success()
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT }}
repository: 100mslive/100ms-links
event-type: alpha-publish
client-payload: '{"bump": "${{ github.event.inputs.publishFlag }}"}'