v5.0.0 #27
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
--- | |
# Inspired by: https://github.com/github/super-linter/blob/main/.github/workflows/deploy-release.yml | |
name: Deploy Release | |
on: | |
release: | |
types: [ published ] | |
workflow_dispatch: | |
inputs: | |
release_version: | |
description: 'version to release. Ex: v4.3.2' | |
required: true | |
default: 'v' | |
env: | |
REGISTRY: ghcr.io | |
permissions: | |
contents: read | |
jobs: | |
build: | |
name: Deploy Docker Image - Release | |
runs-on: ubuntu-latest | |
permissions: | |
deployments: write | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
images: | |
- container-image-id-prefix: "" | |
deployment-environment-identifier: Release | |
image-id: standard | |
timeout-minutes: 60 | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 | |
- name: Get current date | |
run: | | |
echo "Appending the build date contents to GITHUB_ENV..." | |
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "${GITHUB_ENV}" | |
- name: Setup BuildX | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get current Release number | |
# shellcheck disable=SC2062 | |
run: | | |
RELEASE_VERSION=$(echo ${{ github.event.release.name }} \ | |
| grep -E -o "v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+") | |
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_ENV}" | |
if [ -z "${RELEASE_VERSION}" ]; then | |
echo "No release version found in environment, using input..." | |
echo "RELEASE_VERSION=${{ github.event.inputs.release_version }}" \ | |
>> "${GITHUB_ENV}" | |
fi | |
echo "MAJOR_VERSION=${RELEASE_VERSION%%.*}" >> "${GITHUB_ENV}" | |
- name: Start deployment | |
uses: bobheadxi/deployments@88ce5600046c82542f8246ac287d0a53c461bca3 # v1.4.0 | |
id: deployment | |
with: | |
step: start | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: ${{ matrix.images.deployment-environment-identifier }} | |
- name: Build Docker image - ${{ matrix.images.image-id }} | |
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | |
with: | |
context: . | |
file: ./Dockerfile | |
build-args: | | |
BUILD_DATE=${{ env.BUILD_DATE }} | |
BUILD_REVISION=${{ github.sha }} | |
BUILD_VERSION=${{ github.sha }} | |
load: false | |
push: true | |
tags: | | |
${{ env.REGISTRY }}/${{ github.repository }}:${{ matrix.images.container-image-id-prefix }}latest | |
${{ env.REGISTRY }}/${{ github.repository }}:${{ matrix.images.container-image-id-prefix }}${{ env.MAJOR_VERSION }} | |
${{ env.REGISTRY }}/${{ github.repository }}:${{ matrix.images.container-image-id-prefix }}${{ env.RELEASE_VERSION }} | |
- name: Update deployment status | |
uses: bobheadxi/deployments@88ce5600046c82542f8246ac287d0a53c461bca3 # v1.4.0 | |
if: always() | |
with: | |
step: finish | |
token: ${{ secrets.GITHUB_TOKEN }} | |
status: ${{ job.status }} | |
deployment_id: ${{ steps.deployment.outputs.deployment_id }} | |
env: ${{ steps.deployment.outputs.env }} | |
env_url: https://github.com/${{ github.repository }}/releases/tag/${{ env.RELEASE_VERSION }} |