-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (126 loc) · 4.09 KB
/
github-workflow.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
name: CI
on:
push:
branches:
- main
pull_request:
permissions:
contents: write
packages: write
pull-requests: write
env:
NODE_VERSION: 20
APP_NAME: reddit-chat-mobile-fix
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Build ${{ env.APP_NAME }} for Firefox
run: npm run build:firefox
- name: Build ${{ env.APP_NAME }} for Chrome
run: npm run build:chrome
changelog:
name: Changelog
needs:
- build
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
outputs:
skipped: ${{ steps.changelog.outputs.skipped }}
tag: ${{ steps.changelog.outputs.tag }}
clean_changelog: ${{ steps.changelog.outputs.clean_changelog }}
version: ${{ steps.changelog.outputs.version }}
env:
PR_BRANCH: release-ci-${{ github.sha }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Create Branch
run: |
git checkout -b ${{ env.PR_BRANCH }}
- name: Create Changelog
uses: TriPSs/conventional-changelog-action@v6 # angular preset
id: changelog
with:
github-token: ${{ secrets.GH_OWNER_TOKEN }}
git-user-name: "github-actions[bot]"
git-user-email: "github-actions[bot]@users.noreply.github.com"
git-branch: ${{ env.PR_BRANCH }}
skip-git-pull: true
output-file: false
skip-bump: true
version-file: package.json
create-summary: true
- name: Create Changelog PR
if: steps.changelog.outputs.skipped == 'false'
run: |
gh pr create --base main --head ${{ env.PR_BRANCH }} --title 'chore(release): ${{ steps.changelog.outputs.tag }} [skip-ci]' --body '${{ steps.changelog.outputs.clean_changelog }}'
env:
GH_TOKEN: ${{ secrets.GH_OWNER_TOKEN }}
- name: Approve Changelog PR
if: steps.changelog.outputs.skipped == 'false'
run: |
gh pr review --approve ${{ env.PR_BRANCH }}
env:
GH_TOKEN: ${{ secrets.GH_OWNER_TOKEN }}
- name: Merge Changelog PR
if: steps.changelog.outputs.skipped == 'false'
run: |
gh pr merge --squash --auto --delete-branch ${{ env.PR_BRANCH }}
env:
GH_TOKEN: ${{ secrets.GH_OWNER_TOKEN }}
realease:
name: realease
needs: changelog
if: github.event_name != 'pull_request' && needs.changelog.outputs.skipped == 'false'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Build ${{ env.APP_NAME }} for Firefox
run: npm run build:firefox
- name: Create .zip for Firefox build
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: 'firefox.zip'
path: 'dist/'
- name: Build ${{ env.APP_NAME }} for Chrome
run: npm run build:chrome
- name: Create .zip for Chrome build
uses: thedoctor0/[email protected]
with:
type: 'zip'
filename: 'chrome.zip'
path: 'dist/'
- name: Upload Release
uses: ncipollo/[email protected]
with:
artifacts: "firefox.zip,chrome.zip"
token: ${{ secrets.GH_OWNER_TOKEN }}
generateReleaseNotes: true
draft: false
prerelease: false
tag: ${{ needs.changelog.outputs.tag }}
name: ${{ needs.changelog.outputs.tag }}
body: |
<details>
<summary>🤖 Autogenerated Conventional Changelog</summary>
${{ needs.changelog.outputs.clean_changelog }}
</details>