We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6b8d4f commit 9393f8fCopy full SHA for 9393f8f
.github/workflows/build-and-push-image.yml
@@ -1,5 +1,9 @@
1
-name: CI
2
-on: [push]
+name: Build and push image
+
3
+on:
4
+ push:
5
+ tags:
6
+ - "v*"
7
8
jobs:
9
build-and-push-image:
@@ -14,10 +18,15 @@ jobs:
14
18
registry: ghcr.io
15
19
username: ${{ github.actor }}
16
20
password: ${{ secrets.GITHUB_TOKEN }}
21
+ - name: Extract version
22
+ run: |
23
+ echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
24
+ echo $VERSION
17
25
- name: Build and push image
26
run: |
27
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
28
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
29
echo $IMAGE_ID
30
docker build . -t ${IMAGE_ID}
31
+ docker push ${IMAGE_ID}:${VERSION}
32
docker push ${IMAGE_ID}:latest
0 commit comments