Build and Push Release Images #10
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
name: 'Build and Push Release Images' | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to build and push (leave empty for latest)' | |
required: true | |
default: '' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.21.8 | |
- name: 'Login to Azure docker registry' | |
uses: azure/docker-login@v1 | |
with: | |
login-server: testnetobscuronet.azurecr.io | |
username: testnetobscuronet | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: 'Get version' | |
id: get_version | |
run: | | |
if [ "${{ github.event_name }}" = "release" ]; then | |
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
elif [ -n "${{ github.event.inputs.tag }}" ]; then | |
echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT | |
else | |
# Fetch the latest tag from the repository | |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) | |
echo "VERSION=${LATEST_TAG}" >> $GITHUB_OUTPUT | |
fi | |
- name: 'Build and push obscuro node images' | |
env: | |
VERSION: ${{ steps.get_version.outputs.VERSION }} | |
run: | | |
DOCKER_BUILDKIT=1 docker build -t testnetobscuronet.azurecr.io/obscuronet/enclave:${VERSION} -f dockerfiles/enclave.Dockerfile . | |
docker push testnetobscuronet.azurecr.io/obscuronet/enclave:${VERSION} | |
DOCKER_BUILDKIT=1 docker build -t testnetobscuronet.azurecr.io/obscuronet/host:${VERSION} -f dockerfiles/host.Dockerfile . | |
docker push testnetobscuronet.azurecr.io/obscuronet/host:${VERSION} |