-
Notifications
You must be signed in to change notification settings - Fork 6
60 lines (53 loc) · 1.99 KB
/
release-recover-id-object.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Publish Docker image for recover-id-object to DockerHub
on:
push:
tags:
- 'recover-id-object/*.*.*'
workflow_dispatch:
env:
REGISTRY: docker.io
IMAGE_NAME: recover-id-object
RUST_VERSION: rust:1.76-buster # Define the Rust version here
jobs:
publish-docker-image:
runs-on: ubuntu-latest
environment: release-unprivileged
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract version tag from Cargo.toml manifest
id: meta
run: |
VERSION=$(yq .package.version recover-id-object/Cargo.toml)
FULL_IMAGE_TAG="${{ env.REGISTRY }}/concordium/${{ env.IMAGE_NAME }}:$VERSION"
echo "::notice FULL_IMAGE_TAG=${FULL_IMAGE_TAG}"
# Make sure the image does not exist. Abort if we can retrieve any metadata.
if docker manifest inspect $FULL_IMAGE_TAG > /dev/null; then
echo "::error $FULL_IMAGE_TAG already exists"
exit 1
elif [ ! "${{ github.ref_name }}" = "recover-id-object/$VERSION" ]; then
echo "::error ${{ github.ref_name }} does not match recover-id-object/${VERSION}."
exit 1
else
# Store the full image tag into a tag variable for the following step.
echo "tag=${FULL_IMAGE_TAG}" > "$GITHUB_OUTPUT"
fi
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: recover-id-object/scripts/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tag }}
build-args: |
build_image=${{ env.RUST_VERSION }}