Skip to content

Commit 1f19cd6

Browse files
committed
ci: clean up
1 parent 8cd5c48 commit 1f19cd6

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

.github/workflows/ci.yml

+24-12
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ env:
1414
IMAGE_NAME: asciislide
1515

1616
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+
1729
build-and-push:
1830
runs-on: ubuntu-22.04
1931

@@ -46,7 +58,7 @@ jobs:
4658
username: ${{ github.actor }}
4759
password: ${{ secrets.GITHUB_TOKEN }}
4860

49-
-
61+
-
5062
name: Cache Docker layers
5163
uses: actions/cache@v3
5264
with:
@@ -66,11 +78,11 @@ jobs:
6678
cache-from: type=local,src=/tmp/.buildx-cache
6779
cache-to: type=local,dest=/tmp/.buildx-cache
6880

69-
-
81+
-
7082
name: Save Docker image
7183
run: docker save -o image.tar ${{ env.IMAGE_NAME }}:latest
7284

73-
-
85+
-
7486
name: Upload Docker image artifact
7587
uses: actions/upload-artifact@v4
7688
with:
@@ -82,18 +94,18 @@ jobs:
8294
needs: build-and-push
8395

8496
steps:
85-
-
97+
-
8698
name: Download Docker image artifact
8799
uses: actions/download-artifact@v4
88100
with:
89101
name: docker-image
90-
-
102+
-
91103
name: Load Docker image
92104
run: docker load -i image.tar
93-
-
105+
-
94106
name: Checkout code
95107
uses: actions/checkout@v3
96-
-
108+
-
97109
name: Run example build with Docker
98110
uses: addnab/docker-run-action@v3
99111
with:
@@ -116,7 +128,7 @@ jobs:
116128
<p>If you are not redirected automatically, follow this <a href="./example/html/main.html">link to main.html</a>.</p>
117129
</body>
118130
</html>' > build/index.html
119-
-
131+
-
120132
name: Upload example artifact
121133
uses: actions/upload-artifact@v4
122134
with:
@@ -126,27 +138,27 @@ jobs:
126138

127139
deploy-example:
128140
runs-on: ubuntu-22.04
129-
needs: build-example
141+
needs: [build-example, cleanup]
130142
permissions:
131143
contents: write
132144

133145
steps:
134-
-
146+
-
135147
name: Download example artifact
136148
uses: actions/download-artifact@v4
137149
with:
138150
name: example-build
139151
path: ${{ github.workspace }}/public
140152

141-
-
153+
-
142154
name: Verify artifact exists
143155
run: |
144156
if [ ! -d ${{ github.workspace }}/public ]; then
145157
echo "No artifact found, skipping deployment."
146158
exit 1
147159
fi
148160
149-
-
161+
-
150162
name: Deploy to GitHub Pages
151163
uses: peaceiris/actions-gh-pages@v3
152164
with:

0 commit comments

Comments
 (0)