Skip to content
This repository was archived by the owner on Jul 25, 2024. It is now read-only.

Cut Release v0.0.3

Cut Release v0.0.3 #2

Workflow file for this run

name: Release
run-name: Cut Release ${{github.event.inputs.release-version || github.ref_name}}
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # ex. v1.0.0
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+' # ex. v1.1.0-rc1
- 'v0.0.1' # used for testing only
- 'v0.0.1-rc[0-9]+' # used for testing only
workflow_dispatch:
inputs:
release-version:
description: 'Release version (v#.#.#[-rc#])'
required: true
env:
NEW_RELEASE_TAG_FROM_UI: ${{github.event.inputs.release-version}}
TEST_RUN: ${{startsWith(github.event.inputs.release-version || github.ref_name, 'v0.0.1')}}
DOCKER_HUB_PROFILE: amplicalabs
IMAGE_NAME: content-watcher-service
jobs:
build-and-publish-container-image:
name: Build and publish container image
runs-on: ubuntu-latest
steps:
- name: Validate Version Tag
if: env.NEW_RELEASE_TAG_FROM_UI != ''
shell: bash
run: |
version=${{env.NEW_RELEASE_TAG_FROM_UI}}
echo "Release version entered in UI: $version"
regex='^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-rc[1-9]\d*)?$'
if [[ ! $version =~ $regex ]]; then
echo "ERROR: Entered version $version is not valid."
echo "Please use v#.#.#[-rc#] format."
exit 1
fi
echo "valid-version=true" >> $GITHUB_OUTPUT
- name: Check Out Repo
uses: actions/checkout@v4
with:
ref: ${{env.NEW_RELEASE_TAG_FROM_UI}}
- name: Set up tags for cp image
id: cp-tags
uses: docker/metadata-action@v5
with:
flavor: |
latest=auto
images: |
${{env.DOCKER_HUB_PROFILE}}/${{env.IMAGE_NAME}}
tags: |
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: |
linux/amd64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{secrets.DOCKERHUB_USERNAME_FC}}
password: ${{secrets.DOCKERHUB_TOKEN_FC}}
- name: Build and Push content-watcher-service Image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: ${{env.TEST_RUN != 'true'}}
file: ./Dockerfile
tags: ${{ steps.cp-tags.outputs.tags }}