-
Notifications
You must be signed in to change notification settings - Fork 3
165 lines (141 loc) · 6.15 KB
/
release.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Release packages
on:
workflow_dispatch:
inputs:
package:
type: 'choice'
required: true
description: 'Select a package to run the release'
options:
- all
- dialtone
- combinator
- css
- emojis
- icons
- language-server
- tokens
- vue2
- vue3
- eslint-plugin
- stylelint-plugin
- postcss-response-variations
schedule:
- cron: "0 10 * * 2"
env:
HUSKY: 0
jobs:
get-branch-name:
runs-on: ubuntu-latest
outputs:
current_branch: ${{ steps.branch-name.outputs.current_branch }}
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
check-dialpad-member:
runs-on: ubuntu-latest
steps:
# Will prevent the rest of the steps from running on fail
- name: Check if user is a dialpad member
uses: octokit/request-action@v2.x
env:
GITHUB_TOKEN: ${{ secrets.DIALTONE_CI_TOKEN_2 }}
with:
route: GET /orgs/dialpad/members/${{ github.actor }}
release:
needs: [get-branch-name, check-dialpad-member]
if: ${{ contains(fromJSON('["staging", "alpha", "beta"]'), needs.get-branch-name.outputs.current_branch) }}
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
issues: write
pull-requests: write
env:
RELEASE_TAG: ${{ needs.get-branch-name.outputs.current_branch == 'staging' && 'latest' || needs.get-branch-name.outputs.current_branch }}
DIALTONE_VUE3_RELEASE_TAG: ${{ needs.get-branch-name.outputs.current_branch == 'staging' && 'vue3' || needs.get-branch-name.outputs.current_branch }}
NPM_TOKEN: ${{ secrets.DIALTONE_NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.DIALTONE_CI_TOKEN_2 }}
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Use pnpm
uses: pnpm/action-setup@v3
with:
version: 9
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: "${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}"
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Release to GitHub
- name: Release Dialtone ${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'dialtone' }}
run: pnpm nx run dialtone:release
- name: Release Dialtone Combinator ${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'combinator' }}
run: pnpm nx run dialtone-combinator:release
- name: Release Dialtone CSS ${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'css' }}
run: pnpm nx run dialtone-css:release
- name: Release Dialtone Emojis ${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'emojis' }}
run: pnpm nx run dialtone-emojis:release
- name: Release Dialtone Icons ${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'icons' }}
run: pnpm nx run dialtone-icons:release
- name: Release Dialtone Language server ${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'language-server' }}
run: pnpm nx run dialtone-language-server:release
- name: Release Dialtone Tokens ${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'tokens' }}
run: pnpm nx run dialtone-tokens:release
- name: Release Dialtone Vue@${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'vue2' }}
run: pnpm nx run dialtone-vue2:release
- name: Release Dialtone Vue@${{ env.DIALTONE_VUE3_RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'vue3' }}
run: pnpm nx run dialtone-vue3:release
- name: Release Dialtone ESLint Plugin ${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'eslint-plugin' }}
run: pnpm nx run eslint-plugin-dialtone:release
- name: Release Dialtone StyleLint Plugin ${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'stylelint-plugin' }}
run: pnpm nx run stylelint-plugin-dialtone:release
- name: Release Dialtone PostCSS Responsive Variations Plugin ${{ env.RELEASE_TAG }}
if: ${{ github.event_name == 'schedule' || github.event.inputs.package == 'all' || github.event.inputs.package == 'dialtone' }}
run: pnpm nx run postcss-responsive-variations:release
push:
needs: [ release ]
if: ${{ needs.get-branch-name.outputs.current_branch == 'staging' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'production'
fetch-depth: 0
token: ${{ secrets.DIALTONE_CI_TOKEN_2 }}
- name: Merge changes to production
run: |
git merge --ff-only origin/staging
git push