Skip to content

Commit 87c6b0a

Browse files
committed
release docker image on tag
1 parent 8169f70 commit 87c6b0a

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This workflow pushes new docker images on every new tag.
2+
#
3+
# On every new `vX.Y.Z` tag the following images are pushed:
4+
#
5+
# liftedinit/manifest-ledger:vX.Y.Z # is pushed
6+
# liftedinit/manifest-ledger:X.Y.Z # is pushed
7+
# liftedinit/manifest-ledger:X.Y # is updated to X.Y.Z
8+
# liftedinit/manifest-ledger:X # is updated to X.Y.Z
9+
# liftedinit/manifest-ledger:latest # is updated to X.Y.Z
10+
#
11+
# All the images above have support for linux/amd64 and linux/arm64.
12+
#
13+
# Due to QEMU virtualization used to build multi-platform docker images
14+
# this workflow might take a while to complete.
15+
16+
name: Push Docker Images
17+
18+
on:
19+
release:
20+
types: [published, created, edited]
21+
push:
22+
tags:
23+
- 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc
24+
25+
jobs:
26+
chain-images:
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Check out the repo
30+
uses: actions/checkout@v4
31+
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@v3
34+
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
37+
38+
- name: Login to GitHub Container Registry
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.repository_owner }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Parse tag
46+
id: tag
47+
run: |
48+
VERSION=$(echo ${{ github.ref_name }} | sed "s/v//")
49+
MAJOR_VERSION=$(echo $VERSION | cut -d '.' -f 1)
50+
MINOR_VERSION=$(echo $VERSION | cut -d '.' -f 2)
51+
PATCH_VERSION=$(echo $VERSION | cut -d '.' -f 3)
52+
echo "VERSION=$VERSION" >> $GITHUB_ENV
53+
echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV
54+
echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV
55+
echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV
56+
57+
- name: Build and push
58+
id: build_push_image
59+
uses: docker/build-push-action@v5
60+
with:
61+
file: Dockerfile
62+
context: .
63+
push: true
64+
platforms: linux/amd64,linux/arm64
65+
tags: |
66+
ghcr.io/liftedinit/manifest-ledger:${{ env.MAJOR_VERSION }}
67+
ghcr.io/liftedinit/manifest-ledger:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
68+
ghcr.io/liftedinit/manifest-ledger:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}
69+
ghcr.io/liftedinit/manifest-ledger:v${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}

0 commit comments

Comments
 (0)