v0.2.26 - Log Fixes #35
Workflow file for this run
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: Create Prod Image | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
jobs: | |
check-release: | |
name: Check Release | |
runs-on: ubuntu-latest | |
outputs: | |
image_tag: ${{ steps.itag.outputs.itag }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set Image Tag | |
id: itag | |
run: | | |
CARGO_VERSION=$(awk '/\[workspace.package\]/ {flag=1} flag && /version =/ {print $3; flag=0}' Cargo.toml | sed 's/"//g') | |
IMAGE_TAG=v$CARGO_VERSION # set the image tag with "v" prefix | |
echo "Cargo.toml version: $CARGO_VERSION" | |
echo "Image tag: $IMAGE_TAG" | |
echo "itag=$IMAGE_TAG" >> $GITHUB_OUTPUT | |
- name: Check Release Tag | |
run: | | |
if [[ ! "${{ steps.itag.outputs.itag }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "Release tag format is invalid. It should follow the pattern 'vMAJOR.MINOR.PATCH' (e.g., v1.0.0)." | |
exit 1 | |
fi | |
echo "Release tag format is valid." | |
build-and-push: | |
name: Build and Push | |
needs: check-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64, linux/arm64, linux/arm, linux/arm64v8 | |
push: true | |
tags: | | |
firstbatch/dkn-compute-node:latest | |
firstbatch/dkn-compute-node:${{ needs.check-release.outputs.image_tag }} |