-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
standardised the recover id object workflow
- Loading branch information
Showing
2 changed files
with
56 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file was deleted.
Oops, something went wrong.