Skip to content

Release

Release #174

Workflow file for this run

name: Release
on:
release:
types: [published]
# workflow_dispatch:
# reason_to_run:
# description: "Please provide a description why it's need to be run outside of automatic builds process"
# required: false
# default: ""
env:
IMAGE: cluster.dev
REGISTRY: docker.io/clusterdev
jobs:
release:
name: Release bin version
runs-on: ubuntu-latest
# if: github.event_name != 'workflow_dispatch'
container: golang:1.20.2-alpine
steps:
- name: Install make
run: apk add make bash jq curl git
- name: Code checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Release
run: |
git config --global --add safe.directory /__w/cluster.dev/cluster.dev
git fetch --prune --unshallow --tags
./scripts/release.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
push:
name: Release docker image
runs-on: ubuntu-latest
steps:
- name: Code checkout
uses: actions/checkout@v2
- name: Build image
run: |
set -x
VERSION=$(git describe --tag --abbrev=0)
cp Dockerfile-alpine Dockerfile
docker build -t ${IMAGE}:${VERSION}-alpine .
docker tag ${IMAGE}:${VERSION}-alpine ${REGISTRY}/${IMAGE}:${VERSION}-alpine
cp Dockerfile-debian Dockerfile
docker build -t ${REGISTRY}/${IMAGE}:${VERSION}-debian --build-arg CDEV_VERSION=${VERSION}-alpine .
cp Dockerfile-full Dockerfile
docker build -t ${IMAGE} --build-arg CDEV_VERSION=${VERSION}-alpine .
docker tag "${IMAGE}" "${REGISTRY}/${IMAGE}:${VERSION}"
docker tag "${IMAGE}" "${REGISTRY}/${IMAGE}:latest"
- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login --username "${{ secrets.DOCKER_USER }}" --password "${{ secrets.DOCKER_PASS }}"
- name: Push image for release
run: |
VERSION=$(git describe --tag --abbrev=0)
echo IMAGE=${IMAGE}
echo VERSION=${VERSION}
docker push "$REGISTRY/$IMAGE:$VERSION-alpine"
docker push "${REGISTRY}/${IMAGE}:${VERSION}-debian"
docker push "${REGISTRY}/${IMAGE}:${VERSION}"
docker push "${REGISTRY}/${IMAGE}:latest"
# - name: Message why this build was required
# if: github.event.inputs.reason_to_run
# run: echo "Reason for the manual build: ${{ github.event.inputs.reason_to_run }}"