Update spec_version to 65 #528
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: "Image Builder" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
inputs: | |
network: | |
type: choice | |
description: "The network to be forked" | |
options: | |
- porcini | |
- root | |
required: true | |
workflow_run: | |
workflows: | |
- Release | |
types: | |
- completed | |
branches: | |
- "release/*" | |
push: | |
branches: | |
- "release/*" | |
paths: | |
- "**.rs" | |
- "**.ts" | |
- "**.toml" | |
- "**.yml" | |
- "**.lock" | |
- "genesis/**" | |
- "Dockerfile" | |
- "**.ts" | |
env: | |
REGISTRY: "ghcr.io" | |
IMAGE_NAME: "futureversecom/seed" | |
FORK_STATE_IMAGE_NAME: "futureversecom/fork-release-state" | |
jobs: | |
build-image: | |
# only run if release branch CI build passes or its a push to release branch | |
if: github.event.workflow_run.conclusion == 'success' || contains(github.ref_name, 'release') | |
runs-on: [seed-builder] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: ghcr.io login | |
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build 🛠 & Publish 🐳 | |
# build and tag an image with commit hash and 'latest', additionally: | |
# if the commit is tagged, tag the image also e.g. 1.0.0 | |
# if the branch name is release/x.x.x tag the image | |
run: | | |
COMMIT_HASH=$(git rev-parse --short HEAD) | |
echo "commit hash: $COMMIT_HASH" | |
COMMIT_TAG=$((git describe --exact-match --tags HEAD) || true) | |
echo "commit tag(?): $COMMIT_TAG" | |
RELEASE_TAG=$(echo -n $GITHUB_REF | grep -oP '(?<=release/).*' || true) | |
echo "github ref: $GITHUB_REF" | |
echo "release tag(?): $RELEASE_TAG" | |
docker build -t "$REGISTRY/$IMAGE_NAME:$COMMIT_HASH" -t "$REGISTRY/$IMAGE_NAME":latest -f ./Dockerfile . | |
docker push "$REGISTRY/$IMAGE_NAME:$COMMIT_HASH" | |
docker push "$REGISTRY/$IMAGE_NAME:latest" | |
# commit was tagged | |
if [ -n "$COMMIT_TAG" ]; then | |
docker tag "$REGISTRY/$IMAGE_NAME:$COMMIT_HASH" "$REGISTRY/$IMAGE_NAME:$COMMIT_TAG" | |
docker push "$REGISTRY/$IMAGE_NAME:$COMMIT_TAG" | |
fi | |
# branch is a release branch | |
if [ -n "$RELEASE_TAG" ]; then | |
docker tag "$REGISTRY/$IMAGE_NAME:$COMMIT_HASH" "$REGISTRY/$IMAGE_NAME:$RELEASE_TAG" | |
docker push "$REGISTRY/$IMAGE_NAME:$RELEASE_TAG" | |
fi | |
# clean up images | |
docker image prune --filter label=stage=build -f | |
build-root-fork-image: | |
needs: build-image | |
if: github.event.workflow_run.conclusion == 'success' || contains(github.ref_name, 'release') | |
runs-on: [seed-builder] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: ghcr.io login | |
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build 🛠 & Publish 🐳 | |
run: | | |
COMMIT_HASH=$(git rev-parse --short HEAD) | |
NETWORK="root" | |
TAG_NAME=${FORK_STATE_IMAGE_NAME}-${NETWORK} | |
# remove git from .dockerignore (script switches git branches/tags) | |
sed -i '/git$/d' .dockerignore | |
# use DOCKER_BUILDKIT | |
DOCKER_BUILDKIT=1 | |
docker build -t "$REGISTRY/$TAG_NAME:latest" -t "$REGISTRY/$TAG_NAME:$COMMIT_HASH" -f ./dockerimages/fork-state.Dockerfile --build-arg network=$NETWORK . | |
docker push "$REGISTRY/$TAG_NAME:latest" | |
docker push "$REGISTRY/$TAG_NAME:$COMMIT_HASH" | |
# clean up images | |
docker image prune --filter label=stage=build -f | |
build-porcini-fork-image: | |
needs: build-image | |
if: github.event.workflow_run.conclusion == 'success' || contains(github.ref_name, 'release') | |
runs-on: [seed-builder] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: ghcr.io login | |
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build 🛠 & Publish 🐳 | |
run: | | |
COMMIT_HASH=$(git rev-parse --short HEAD) | |
NETWORK="porcini" | |
TAG_NAME=${FORK_STATE_IMAGE_NAME}-${NETWORK} | |
# remove git from .dockerignore (script switches git branches/tags) | |
sed -i '/git$/d' .dockerignore | |
# use DOCKER_BUILDKIT | |
DOCKER_BUILDKIT=1 | |
docker build -t "$REGISTRY/$TAG_NAME:latest" -t "$REGISTRY/$TAG_NAME:$COMMIT_HASH" -f ./dockerimages/fork-state.Dockerfile --build-arg network=$NETWORK . | |
docker push "$REGISTRY/$TAG_NAME:latest" | |
docker push "$REGISTRY/$TAG_NAME:$COMMIT_HASH" | |
# clean up images | |
docker image prune --filter label=stage=build -f | |
build-release-state-image-on-demand: | |
# ensure the job only runs for workflow_dispatch event | |
if: github.event_name == 'workflow_dispatch' | |
runs-on: [seed-builder] | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: ghcr.io login | |
uses: docker/login-action@49ed152c8eca782a232dede0303416e8f356c37b | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build 🛠 & Publish 🐳 | |
run: | | |
COMMIT_HASH=$(git rev-parse --short HEAD) | |
NETWORK=${{ github.event.inputs.network }} | |
TAG_NAME=${FORK_STATE_IMAGE_NAME}-${NETWORK} | |
# remove git from .dockerignore (script switches git branches/tags) | |
sed -i '/git$/d' .dockerignore | |
# use DOCKER_BUILDKIT | |
DOCKER_BUILDKIT=1 | |
docker build -t "$REGISTRY/$TAG_NAME:latest" -t "$REGISTRY/$TAG_NAME:$COMMIT_HASH" -f ./dockerimages/fork-state.Dockerfile --build-arg network=$NETWORK . | |
docker push "$REGISTRY/$TAG_NAME:latest" | |
docker push "$REGISTRY/$TAG_NAME:$COMMIT_HASH" | |
# clean up images | |
docker image prune --filter label=stage=build -f |