Release chainweb-node from 20b8ecb744e2e3020f1d93e60afc16b7ef092744 #5
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: Release - Bump and Publish Version | |
## Release automation for chainweb-node | |
# Designed to run systems in chainweb/binary-release | |
## Currently has manual version setting and creates draft releases; | |
# when we are confident in this process, it can auto-increment and publish non-drafts | |
# tbd: connect k8s firing mechanism, create and connect chainweb-node-docker update workflow | |
run-name: "Release chainweb-node ${{ inputs.release_sha }} from ${{ github.sha}}" | |
on: | |
workflow_dispatch: | |
inputs: | |
SHORT_SHA: | |
description: "hash of chainweb-node release, default to branch running this job" | |
type: string | |
required: true | |
VERSION_NEW: | |
description: "The X.Y.Z tag for the new version" | |
type: string | |
required: true | |
GHC_VERSION: | |
description: "Input an updated ghc version" | |
type: string | |
required: false | |
workflow_call: | |
inputs: | |
SHORT_SHA: | |
description: "hash of chainweb-node release, default to branch running this job" | |
type: string | |
required: true | |
VERSION_NEW: | |
description: "The X.Y.Z tag for the new version" | |
type: string | |
required: true | |
GHC_VERSION: | |
description: "Input an updated ghc version" | |
type: string | |
required: false | |
jobs: | |
Build-Push: | |
runs-on: ubuntu-latest | |
outputs: | |
DOCKERHUB_SHA: ${{ steps.validate-sha.outputs.DOCKERHUB_SHA }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: kadena-io/chainweb-node-docker | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_PAT }} | |
- name: Update Dockerfile reference sha | |
run: | | |
echo "DOCKERHUB_SHA=not yet updated" >> $GITHUB_ENV | |
sed -i -e "s/ARG REVISION=.*/ARG REVISION=${{ inputs.SHORT_SHA }}/" Dockerfile | |
- name: Update GHC version if needed | |
run: | | |
if [[ ! -z ${{ inputs.GHC_VERSION }} ]]; then | |
sed -i -e "s/ARG GHCVER=.*/ARG GHCVER=${{ inputs.GHC_VERSION }}/" Dockerfile | |
fi | |
- name: Build and push ubuntu image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64 | |
push: true | |
tags: kadena/chainweb-node:${{ inputs.VERSION_NEW }},kadena/chainweb-node:latest | |
- name: Test run docker image | |
run: | | |
docker run --rm kadena/chainweb-node:${{ inputs.VERSION_NEW }} ./chainweb-node --version | |
- name: Update master branch with dockerfile version | |
run: | | |
git config --local user.name "Kadena DevOps" | |
git config --local user.email "[email protected]" | |
git add Dockerfile | |
git tag chainweb-${{ inputs.VERSION_NEW }} | |
git commit --allow-empty -m "chainweb-node version bump ${{ inputs.VERSION_NEW }}" | |
# allow empty in case this is a re-run | |
git status | |
git push origin chainweb-${{ inputs.VERSION_NEW }} | |
- name: Validate SHAs | |
id: validate-sha | |
run: | | |
## spit these to output | |
digest1=$(docker inspect kadena/chainweb-node:${{ inputs.VERSION_NEW }} --format '{{ .RepoDigests }}') | |
digest2=$(docker inspect kadena/chainweb-node:latest --format '{{ .RepoDigests }}') | |
if [[ $digest1 != $digest2 ]]; then | |
echo "DOCKERHUB_SHA=sha mismatches in dockerhub image" >> $GITHUB_ENV | |
exit 1 | |
fi | |
echo "DOCKERHUB_SHA=$digest1" >> $GITHUB_OUTPUT | |
echo "DOCKERHUB_SHA=$digest1" |