14
14
IMAGE_NAME : asciislide
15
15
16
16
jobs :
17
+ cleanup :
18
+ runs-on : ubuntu-latest
19
+ permissions : write-all
20
+
21
+ steps :
22
+ - name : Clean up deployments
23
+ uses : strumwolf/delete-deployment-environment@v2
24
+ with :
25
+ token : ${{ secrets.GITHUB_TOKEN }}
26
+ environment : github-pages
27
+ onlyRemoveDeployments : true
28
+
17
29
build-and-push :
18
30
runs-on : ubuntu-22.04
19
31
46
58
username : ${{ github.actor }}
47
59
password : ${{ secrets.GITHUB_TOKEN }}
48
60
49
- -
61
+ -
50
62
name : Cache Docker layers
51
63
uses : actions/cache@v3
52
64
with :
@@ -66,11 +78,11 @@ jobs:
66
78
cache-from : type=local,src=/tmp/.buildx-cache
67
79
cache-to : type=local,dest=/tmp/.buildx-cache
68
80
69
- -
81
+ -
70
82
name : Save Docker image
71
83
run : docker save -o image.tar ${{ env.IMAGE_NAME }}:latest
72
84
73
- -
85
+ -
74
86
name : Upload Docker image artifact
75
87
uses : actions/upload-artifact@v4
76
88
with :
@@ -82,18 +94,18 @@ jobs:
82
94
needs : build-and-push
83
95
84
96
steps :
85
- -
97
+ -
86
98
name : Download Docker image artifact
87
99
uses : actions/download-artifact@v4
88
100
with :
89
101
name : docker-image
90
- -
102
+ -
91
103
name : Load Docker image
92
104
run : docker load -i image.tar
93
- -
105
+ -
94
106
name : Checkout code
95
107
uses : actions/checkout@v3
96
- -
108
+ -
97
109
name : Run example build with Docker
98
110
uses : addnab/docker-run-action@v3
99
111
with :
@@ -116,7 +128,7 @@ jobs:
116
128
<p>If you are not redirected automatically, follow this <a href="./example/html/main.html">link to main.html</a>.</p>
117
129
</body>
118
130
</html>' > build/index.html
119
- -
131
+ -
120
132
name : Upload example artifact
121
133
uses : actions/upload-artifact@v4
122
134
with :
@@ -126,27 +138,27 @@ jobs:
126
138
127
139
deploy-example :
128
140
runs-on : ubuntu-22.04
129
- needs : build-example
141
+ needs : [ build-example, cleanup]
130
142
permissions :
131
143
contents : write
132
144
133
145
steps :
134
- -
146
+ -
135
147
name : Download example artifact
136
148
uses : actions/download-artifact@v4
137
149
with :
138
150
name : example-build
139
151
path : ${{ github.workspace }}/public
140
152
141
- -
153
+ -
142
154
name : Verify artifact exists
143
155
run : |
144
156
if [ ! -d ${{ github.workspace }}/public ]; then
145
157
echo "No artifact found, skipping deployment."
146
158
exit 1
147
159
fi
148
160
149
- -
161
+ -
150
162
name : Deploy to GitHub Pages
151
163
uses : peaceiris/actions-gh-pages@v3
152
164
with :
0 commit comments