-
Notifications
You must be signed in to change notification settings - Fork 48
144 lines (138 loc) · 4.63 KB
/
release.yml
File metadata and controls
144 lines (138 loc) · 4.63 KB
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
name: Release
on:
workflow_dispatch:
inputs:
snapshot:
description: "Create snapshot release"
type: boolean
default: true
tag:
description: "npm tag (for snapshot releases)"
type: choice
default: "test"
options:
- next
- test
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
snapshot:
name: Snapshot Release
runs-on: ubuntu-latest
if: ${{ github.event.inputs.snapshot == 'true' }}
permissions:
contents: read
pull-requests: write
id-token: write
packages: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/gh-setup
- name: Build
run: pnpm build
- name: Install ## running install again for designsystemt bin to be registered
run: pnpm install --frozen-lockfile
shell: bash
- id: snapshot
name: Set Snapshot Name
run: |
NAME="${{ github.ref_name }}"
NAME="${NAME//\//-}"
echo "name=${NAME}" >> $GITHUB_OUTPUT
- name: Create Snapshot Release
run: |
pnpm changeset version --snapshot "${{ steps.snapshot.outputs.name }}"
echo '---'
echo 'Detected Changes:'
git diff
echo '---'
pnpm run publish-packages --tag "${{ github.event.inputs.tag }}" --no-git-tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ""
release:
name: Release
runs-on: ubuntu-latest
timeout-minutes: 20
if: ${{ github.event.inputs.snapshot != 'true' }}
permissions:
contents: write
pull-requests: write
id-token: write
packages: write
outputs:
published: ${{ steps.changesets.outputs.published }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/gh-setup
- name: Build Designsystemet CLI
run: pnpm build:types && pnpm build:cli
- name: Install ## running install again for designsystemt bin to be registered
run: pnpm install --frozen-lockfile
shell: bash
- name: Store release version for changeset
id: release_version
run: echo "VALUE=$(bash ./scripts/print_release_version.sh)" >> $GITHUB_OUTPUT
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release Pull Request or Publish to npm
id: changesets
# Forked version of the changesets action that supports aggregated releases
uses: dotansimha/changesets-action@069996e9be15531bd598272996fa23853d61590e # v1.5.2
with:
publish: pnpm publish-packages
version: pnpm version-packages
commit: "chore: new release"
title: "chore: new release"
createGithubReleases: aggregate
githubReleaseName: v${{ steps.release_version.outputs.value }}
githubTagName: v${{ steps.release_version.outputs.value }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: "" # https://github.com/changesets/changesets/issues/1152#issuecomment-3190884868
deploy-www:
permissions:
id-token: write
contents: read
pull-requests: write
needs: release
if: ${{ needs.release.outputs.published == 'true' }}
uses: ./.github/workflows/azure-deploy-www.yml
with:
environment: "production"
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
SLACK_INVITE_URL: ${{ secrets.SLACK_INVITE_URL }}
deploy-theme:
permissions:
id-token: write
contents: read
pull-requests: write
needs: release
if: ${{ needs.release.outputs.published == 'true' }}
uses: ./.github/workflows/azure-deploy-themebuilder.yml
with:
environment: "production"
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
deploy-storybook:
permissions:
id-token: write
contents: read
pull-requests: write
needs: release
if: ${{ needs.release.outputs.published == 'true' }}
uses: ./.github/workflows/azure-deploy-storybook.yml
with:
environment: "production"
secrets:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}