Skip to content

Release chainweb-node from 65ab52b20c34e86787263ee44752e5dcf9930924 #6

Release chainweb-node from 65ab52b20c34e86787263ee44752e5dcf9930924

Release chainweb-node from 65ab52b20c34e86787263ee44752e5dcf9930924 #6

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
outputs:
DOCKERHUB_SHA:
description: "The sha of the final dockerhub image"
value: ${{ jobs.Build-Push.outputs.DOCKERHUB_SHA }}
jobs:
Build-Push:
runs-on: ubuntu-latest
outputs:
DOCKERHUB_SHA: ${{ steps.validate-sha.outputs.DOCKERHUB_SHA }}
steps:
- uses: actions/checkout@v4
with:
repository: kadena-io/chainweb-node-docker
ssh-key: ${{ secrets.GH_DEPLOYKEY_CHAINWEBDOCKER }}
- 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
cat Dockerfile
- 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 "devops@kadena.io"
git add Dockerfile
git commit --allow-empty -m "chainweb-node version bump ${{ inputs.VERSION_NEW }}"
# allow empty in case this is a re-run
git status
git tag chainweb-${{ inputs.VERSION_NEW }}
git push
git push origin --tags
- name: Validate SHAs
id: validate-sha
run: |
## spit these to output
docker pull kadena/chainweb-node:${{ inputs.VERSION_NEW }}
docker pull kadena/chainweb-node:latest
digest1=$(docker inspect kadena/chainweb-node:${{ inputs.VERSION_NEW }} --format '{{ .RepoDigests }}')
digest2=$(docker inspect kadena/chainweb-node:latest --format '{{ .RepoDigests }}')
echo "$digest1 and $digest2"
if [[ "$digest1" != "$digest2" ]]; then
echo "DOCKERHUB_SHA=sha mismatches in dockerhub image" >> $GITHUB_OUTPUT
echo "sha mismatch between pushed images"
exit 1
fi
echo "Digest compare succeeded, new tags match"
echo "DOCKERHUB_SHA=$digest1" >> $GITHUB_OUTPUT
echo "Pushed to github output"