-
Notifications
You must be signed in to change notification settings - Fork 65
181 lines (153 loc) · 4.5 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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: "Release"
on:
push:
branches:
- main
jobs:
docker:
name: Build container
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
- name: "🔧 setup buildx"
uses: docker/setup-buildx-action@v1
- name: "🔧 cache docker layers"
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: "🔧 docker meta"
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ github.repository }}
tags: latest
- name: "📦 docker build"
uses: docker/build-push-action@v2
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/docker.tar
push: false
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
- name: "📂 docker artifacts"
uses: actions/upload-artifact@v2
with:
name: docker
path: /tmp/docker.tar
build:
name: Build application
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
- name: "🔧 setup node"
uses: actions/[email protected]
with:
node-version: 20
- name: "🔧 install npm@latest"
run: npm i -g npm@latest
- name: "📦 install dependencies"
uses: bahmutov/npm-install@v1
- name: "🚀 static app"
run: npm run build
- name: "📂 production artifacts"
uses: actions/upload-artifact@v2
with:
name: build
path: build
release:
environment:
name: production
url: https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_TAG }}
name: Semantic release
needs:
- docker
- build
runs-on: ubuntu-latest
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: "📂 download docker artifacts"
uses: actions/download-artifact@v2
with:
name: docker
path: /tmp
- name: "📦 load tag"
run: |
docker load --input /tmp/docker.tar
docker image ls -a
- name: "📂 download build artifacts"
uses: actions/download-artifact@v2
with:
name: build
path: /tmp/build
- name: "🚀 release"
id: semantic-release
uses: docker://ghcr.io/open-sauced/semantic-release-conventional-config:3.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy:
name: Deploy to static
needs:
- build
- release
runs-on: ubuntu-latest
services:
docs:
image: ghcr.io/${{ github.repository }}:latest
ports:
- 8080:80
steps:
- name: "☁️ checkout repository"
uses: actions/checkout@v2
- name: "📂 download artifacts"
uses: actions/download-artifact@v2
with:
name: build
path: /home/runner/build
- name: Install Prince
run: |
curl https://www.princexml.com/download/prince-14.2-linux-generic-x86_64.tar.gz -O
tar zxf prince-14.2-linux-generic-x86_64.tar.gz
cd prince-14.2-linux-generic-x86_64
yes "" | sudo ./install.sh
- name: "🔧 setup node"
uses: actions/[email protected]
with:
node-version: 18
- name: "🔧 install npm@latest"
run: npm i -g npm@latest
- name: "📦 install dependencies"
uses: bahmutov/npm-install@v1
- name: "📂 copy artifacts"
run: cp -R /home/runner/build .
- name: "🚀 generate pdf"
run: npm run pdf
- name: "🚀 deploy static"
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
commit_message: ${{ github.event.head_commit.message }}
enable_jekyll: false
cname: docs.opensauced.pizza
cleanup:
name: Cleanup actions
needs:
- deploy
runs-on: ubuntu-latest
steps:
- name: "♻️ remove build artifacts"
uses: geekyeggo/delete-artifact@v1
with:
name: |
build
docker