-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (80 loc) · 2.9 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
name: Release
on:
push:
branches:
- main
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
Release:
name: 🚀 Release
runs-on: ubuntu-latest
timeout-minutes: 15
env:
HUSKY: 0
steps:
- name: 👷 Build Design System
uses: ./.github/workflows/actions/build
with:
build: false
- uses: ./.github/workflows/actions/setup-release
with:
token: ${{ secrets.GITHUB_TOKEN }}
npm-token: ${{ secrets.NPM_TOKEN }}
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: npm run release
env:
HUSKY_DISABLED: 1
BAL_DS_RELEASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
- name: Echo Changeset output
shell: bash
run: |
echo "Changeset published - ${{ steps.changesets.outputs.published }}"
echo "Changeset publishedPackages - ${{ steps.changesets.outputs.publishedPackages }}"
echo "Changeset hasChangesets - ${{ steps.changesets.outputs.hasChangesets }}"
echo "Changeset pullRequestNumber - ${{ steps.changesets.outputs.pullRequestNumber }}"
- name: Update lock file
if: steps.changesets.outputs.published == 'true'
run: npm install
shell: bash
- name: Commit lock file
if: steps.changesets.outputs.published == 'true'
uses: EndBug/add-and-commit@v9
with:
add: 'package-lock.json'
message: 'chore(): update lock file'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Tag release
if: steps.changesets.outputs.published == 'true'
uses: thejeff77/[email protected]
with:
tag: 'v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}'
message: 'v${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}'
- name: Update changelog file
if: steps.changesets.outputs.published == 'true'
run: awk 'NR==1 {print "# Changelog"} NR!=1' packages/components/CHANGELOG.md > CHANGELOG.md
shell: bash
- name: Commit changelog
if: steps.changesets.outputs.published == 'true'
uses: EndBug/add-and-commit@v9
with:
add: 'CHANGELOG.md'
message: 'chore(): update changelog'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Merge main -> production
if: steps.changesets.outputs.published == 'true'
uses: devmasx/merge-branch@master
with:
type: now
from_branch: main
target_branch: production
message: ':bookmark: release: ${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}'
github_token: ${{ secrets.GITHUB_TOKEN }}