-
Notifications
You must be signed in to change notification settings - Fork 37
144 lines (126 loc) · 5.09 KB
/
Copy pathbuild-extension.yml
File metadata and controls
144 lines (126 loc) · 5.09 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: build-extension
run-name: ${{ github.actor }} extension build
on:
push:
branches:
- dev
tags:
- '@job-hunting/extension@*'
pull_request:
branches:
- dev
env:
ROOT_DIR: apps/extension/
permissions:
contents: write
jobs:
build-extension:
runs-on: ubuntu-latest
steps:
- name: Set Version Env
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "VERSION=$(echo '${{ github.ref_name }}' | sed -e 's/\@job-hunting\/extension\@//g')" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda
name: Install pnpm
with:
version: 10.5.0
run_install: false
- name: Install Node.js
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610
with:
node-version: 22
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run unit tests
run: |
pnpm exec nx run @job-hunting/extension:test:unit
- name: Zip extensions
run: |
pnpm install
pnpm exec nx run @job-hunting/extension:zip
pnpm exec nx run @job-hunting/extension:zip:firefox
- name: Setup e2e tests
run: |
pnpm exec nx run @job-hunting/extension:test:e2e:install
- name: Run e2e tests
run: |
pnpm exec nx run @job-hunting/extension:test:e2e
- name: (cucumber-report)Upload test report to action artifacts
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
if: ${{ !cancelled() }}
with:
name: extension-e2e-tests-cucumber-report
path: ${{ env.ROOT_DIR }}cucumber-report/
retention-days: 30
- name: (allure-report)Set up JDK
uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12
if: ${{ !cancelled() }}
with:
distribution: zulu
java-version: 17
- name: (allure-report)Load test report history
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
if: ${{ !cancelled() }}
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: (allure-report)Build test report
uses: simple-elf/allure-report-action@f841fec0e421b5d7d8e807dedfb03efb8cf30303
if: ${{ !cancelled() }}
with:
gh_pages: gh-pages
allure_history: gh-pages
allure_results: ${{ env.ROOT_DIR }}allure-results
- name: (allure-report)Upload test report to action artifacts
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1
if: ${{ !cancelled() }}
with:
name: extension-e2e-tests-allure-report
path: allure-report/
retention-days: 30
- name: (allure-report)Publish test report to gh-pages
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e
if: ${{ (github.event_name != 'pull_request') && !cancelled()}}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: gh-pages
- name: Rename dist files
if: startsWith(github.ref, 'refs/tags/')
run: |
CHROME_ZIP=$(ls ${{ env.ROOT_DIR }}.output/job-huntingextension-*-chrome.zip)
FIREFOX_ZIP=$(ls ${{ env.ROOT_DIR }}.output/job-huntingextension-*-firefox.zip)
mv "$CHROME_ZIP" ${{ env.ROOT_DIR }}.output/job-hunting-extension-chrome-${{ env.VERSION }}.zip
mv "$FIREFOX_ZIP" ${{ env.ROOT_DIR }}.output/job-hunting-extension-firefox-${{ env.VERSION }}.zip
- name: Deploy chrome dist branch
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8
with:
branch: dist/chrome-${{ github.ref_name }}
folder: ${{ env.ROOT_DIR }}.output/chrome-mv3
if: github.event_name != 'pull_request'
- name: Deploy firefox dist branch
uses: JamesIves/github-pages-deploy-action@6c2d9db40f9296374acc17b90404b6e8864128c8
with:
branch: dist/firefox-${{ github.ref_name }}
folder: ${{ env.ROOT_DIR }}.output/firefox-mv2
if: github.event_name != 'pull_request'
- name: Gen latest changelog
if: startsWith(github.ref, 'refs/tags/')
run: |
awk '/^##[^#]/{print NR}' ${{ env.ROOT_DIR }}CHANGELOG.md | head -n 2 | xargs | tr ' ' ',' | xargs -I {} sed -n {}p ${{ env.ROOT_DIR }}CHANGELOG.md | sed '$d' > ${{ env.ROOT_DIR }}CHANGELOG.txt
- name: Release
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ env.ROOT_DIR }}CHANGELOG.txt
make_latest: true
files: |
${{ env.ROOT_DIR }}.output/job-hunting-extension-chrome-${{ env.VERSION }}.zip
${{ env.ROOT_DIR }}.output/job-hunting-extension-firefox-${{ env.VERSION }}.zip