forked from VueTorrent/VueTorrent
-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (140 loc) · 4.36 KB
/
build-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
name: Build project and release
on:
push:
branches:
- master
jobs:
setup-release:
name: Run Release Please action
outputs:
release_created: ${{ steps.release.outputs.release_created }}
upload_url: ${{ steps.release.outputs.upload_url }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Run release please
uses: googleapis/release-please-action@v4
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
build-release:
name: Build VueTorrent
runs-on: ubuntu-latest
strategy:
matrix:
npm-step: [ 'build', 'build-demo' ]
include:
- npm-step: build
artifact-name: vuetorrent-build
artifact-path: ./vuetorrent
- npm-step: build-demo
artifact-name: vuetorrent-demo
artifact-path: ./vuetorrent-demo
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build Node.js cache
uses: actions/cache@v4
with:
path: ~/.npm
key: "${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}"
restore-keys: ${{ runner.os }}-node-
- name: Install dependencies
run: npm ci
- name: Update locales data
run: |
curl -H 'X-API-KEY: ${{ secrets.TOLGEE_TOKEN }}' 'https://app.tolgee.io/v2/projects/export' -o locales.zip
unzip -o -d ./src/locales locales.zip
rm locales.zip
- name: Update locales metadata
uses: VueTorrent/tolgee-action@v1
with:
tolgee_secret: ${{ secrets.TOLGEE_TOKEN }}
- name: Build VueTorrent
run: npm run ${{ matrix.npm-step }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.artifact-path }}
retention-days: 1
push-nightly:
name: Push to nightly branch
runs-on: ubuntu-latest
needs: build-release
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: vuetorrent-build
path: ./vuetorrent
- name: Push to nightly-release
uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
branch: nightly-release
folder: ./vuetorrent
push-demo:
name: Push to demo repo
runs-on: ubuntu-latest
needs: build-release
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: vuetorrent-demo
path: ./vuetorrent-demo
- name: Push to demo repo
uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
folder: './vuetorrent-demo'
repository-name: 'VueTorrent/demo'
token: ${{ secrets.GH_PAT }}
upload-release:
name: Upload release to GitHub
needs: [ setup-release, build-release ]
if: needs.setup-release.outputs.release_created
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: vuetorrent-build
path: ./vuetorrent
- name: Zip VueTorrent
run: zip -qq -r ./vuetorrent.zip ./vuetorrent
- name: Upload VueTorrent release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup-release.outputs.upload_url }}
asset_path: ./vuetorrent.zip
asset_name: vuetorrent.zip
asset_content_type: application/zip
push-release:
name: Push to latest branch
needs: [ setup-release, build-release ]
if: needs.setup-release.outputs.release_created
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: vuetorrent-build
path: ./vuetorrent
- name: Push to latest-release
uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
branch: latest-release
folder: ./vuetorrent