MSP-5494 add github actions ci to build & publish docker image
This commit is contained in:
1 parent
d02a58345e
commit
c371b68ba7
1 file changed
+7
-5
@@ -1,7 +1,9 @@
|
|||||||
name: Create and publish a Docker image
|
name: Create and publish a Docker image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
@@ -19,10 +21,10 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Read version from file
|
- name: Get version from tag
|
||||||
id: version_reader
|
id: version_reader
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(cat .version)
|
VERSION=${GITHUB_REF_NAME#v}
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
@@ -43,7 +45,7 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_reader.outputs.version }}
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.version_reader.outputs.version }}
|
||||||
${{ github.ref == 'refs/heads/main' && format('{0}/{1}:latest', env.REGISTRY, env.IMAGE_NAME) || ''}}
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
labels: |
|
labels: |
|
||||||
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
|
org.opencontainers.image.title=${{ env.IMAGE_NAME }}
|
||||||
org.opencontainers.image.version=${{ steps.version_reader.outputs.version }}
|
org.opencontainers.image.version=${{ steps.version_reader.outputs.version }}
|
||||||
@@ -55,4 +57,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
|
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
|
||||||
subject-digest: ${{ steps.push.outputs.digest }}
|
subject-digest: ${{ steps.push.outputs.digest }}
|
||||||
push-to-registry: true
|
push-to-registry: true
|
||||||
Reference in new issue
Block a user