Skip to content

Commit

Permalink
Add release flow to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilKWarmdahl committed Jan 8, 2025
1 parent 25d81c4 commit 9562648
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/release-reproducible-smart-contract.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
on:
push:
branches:
- ekw/SRE-1010/migrate-release-flow-gha
tags:
- verifiable-sc/*

env:
SERVICE_NAME: 'verifiable-sc'
SOURCE_IMAGE_TAG: 'rust:1.75.0'

jobs:
release-docker:
runs-on: ubuntu-latest
environment: release
steps:
- name: Login to Docker Hub
if: ${{ secrets.DOCKERHUB_TOKEN }}
uses: docker/login-action@v3
with:
username: 'concordium'
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Clone repo
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
submodules: recursive

- name: Set image tag if correctly formatted
env:
TAG: ${{ github.ref_name }}
run: |
SERVICE_TAG=${TAG##${{ env.SERVICE_NAME }}/}
IFS='-' read -r ENVIRONMENT TAG_VERSION <<< "$SERVICE_TAG"
echo "FULL_IMAGE_TAG=concordium/${{ env.SERVICE_NAME }}-${TAG_VERSION}" >> $GITHUB_ENV
echo "ENVIRONMENT=$ENVIRONMENT" >> $GITHUB_ENV
- name: Check if image exist
run: |
set +e
docker manifest inspect ${{ env.FULL_IMAGE_TAG }}
EXITCODE=$?
if [ $EXITCODE -eq "0" ]; then
echo "Error: ${{ env.FULL_IMAGE_TAG }} already exist"
exit 1
fi
- name: Build and push docker image
if: ${{ secrets.DOCKERHUB_TOKEN }}
uses: docker/build-push-action@v6
with:
context: ./reproducible
file: ./reproducible/build.Dockerfile
tags: ${{ env.FULL_IMAGE_TAG }}
no-cache: true
push: false
build-args: |
source_image=${{ env.SOURCE_IMAGE_TAG }}

0 comments on commit 9562648

Please sign in to comment.