Skip to content

Commit 5e0995c

Browse files
committed
GHA to publish image
1 parent fcf70e3 commit 5e0995c

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
on:
2+
release:
3+
types: [published, edited]
4+
5+
jobs:
6+
docker:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Set up Docker Buildx
10+
uses: docker/setup-buildx-action@v1
11+
- name: Cache Docker layers
12+
uses: actions/cache@v2
13+
with:
14+
path: /tmp/.buildx-cache
15+
key: ${{ runner.os }}-buildx-${{ github.sha }}
16+
restore-keys: |
17+
${{ runner.os }}-buildx-
18+
- name: Log in to the Container registry
19+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Build and push
25+
id: docker_build
26+
uses: docker/build-push-action@v2
27+
with:
28+
push: true
29+
tags: ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}
30+
cache-from: type=local,src=/tmp/.buildx-cache
31+
cache-to: type=local,dest=/tmp/.buildx-cache-new
32+
33+
# Temp fix
34+
# https://github.com/docker/build-push-action/issues/252
35+
# https://github.com/moby/buildkit/issues/1896
36+
- name: Move cache
37+
run: |
38+
rm -rf /tmp/.buildx-cache
39+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
40+
41+
- name: Image digest
42+
run: echo ${{ steps.docker_build.outputs.digest }}
43+

0 commit comments

Comments
 (0)