Skip to content

Commit

Permalink
standardised the recover id object workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
lassemand committed Jul 24, 2024
1 parent 125f7d0 commit 5cb7cb4
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 39 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/release-recover-id-object.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish Docker image for recover-id-object to DockerHub

on:
push:
tags:
- 'recover-id-object/*.*.*'

env:
REGISTRY: docker.io
IMAGE_NAME: recover-id-object
RUST_VERSION: rust:1.74-buster # Define the Rust version here

jobs:
publish-docker-image:
runs-on: ubuntu-latest
environment: release-recover-id-object
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- 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 Expected tag ${EXPECTED_TAG} does not match the version ${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
echo "tag=$FULL_IMAGE_TAG" >> $GITHUB_ENV
- 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 }}
39 changes: 0 additions & 39 deletions .github/workflows/release.yml

This file was deleted.

0 comments on commit 5cb7cb4

Please sign in to comment.