Skip to content

2.1.870

2.1.870 #25

Workflow file for this run

name: Release
on:
release:
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:
description: "Tag name"
required: true
env:
REGISTRY: ghcr.io
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
retag-docker-image:
runs-on: ubuntu-latest
name: Push updated Docker image
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set environment variables
run: |
echo VERSION=${TAG_NAME#v} >> $GITHUB_ENV
echo BASE_IMAGE_NAME=$REGISTRY/$(echo ${GITHUB_REPOSITORY,,}) >> $GITHUB_ENV
echo COMMITED_AT=$(git show -s --format=%cI `git rev-parse HEAD`) >> $GITHUB_ENV
echo REVISION=$(git rev-parse --short HEAD) >> $GITHUB_ENV
- name: Collect Docker image metadata (api-legacy)
id: meta-api-legacy
uses: docker/metadata-action@v5
with:
images: ${{ env.BASE_IMAGE_NAME }}-api-legacy
labels: |
org.opencontainers.image.created=${{ env.COMMITED_AT }}
org.opencontainers.image.version=v${{ env.VERSION }}
org.opencontainers.image.maintainer=GeoWerkstatt GmbH <support@geowerkstatt.ch>
tags: |
type=semver,pattern=v{{version}}
- name: Collect Docker image metadata (api)
id: meta-api
uses: docker/metadata-action@v5
with:
images: ${{ env.BASE_IMAGE_NAME }}-api
labels: |
org.opencontainers.image.created=${{ env.COMMITED_AT }}
org.opencontainers.image.version=v${{ env.VERSION }}
org.opencontainers.image.maintainer=GeoWerkstatt GmbH <support@geowerkstatt.ch>
tags: |
type=semver,pattern=v{{version}}
- name: Collect Docker image metadata (client)
id: meta-client
uses: docker/metadata-action@v5
with:
images: ${{ env.BASE_IMAGE_NAME }}-client
labels: |
org.opencontainers.image.created=${{ env.COMMITED_AT }}
org.opencontainers.image.version=v${{ env.VERSION }}
org.opencontainers.image.maintainer=GeoWerkstatt GmbH <support@geowerkstatt.ch>
tags: |
type=semver,pattern=v{{version}}
- name: Collect Docker image metadata (view-sync)
id: meta-view-sync
uses: docker/metadata-action@v5
with:
images: ${{ env.BASE_IMAGE_NAME }}-view-sync
labels: |
org.opencontainers.image.created=${{ env.COMMITED_AT }}
org.opencontainers.image.version=v${{ env.VERSION }}
org.opencontainers.image.maintainer=GeoWerkstatt GmbH <support@geowerkstatt.ch>
tags: |
type=semver,pattern=v{{version}}
- name: Log in to the GitHub container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image (api-legacy)
uses: docker/build-push-action@v5
with:
context: ./src/api-legacy
push: true
build-args: |
VERSION=${{ env.VERSION }}
REVISION=${{ env.REVISION }}
tags: ${{ steps.meta-api-legacy.outputs.tags }}
labels: ${{ steps.meta-api-legacy.outputs.labels }}
cache-from: type=registry,ref=${{ env.BASE_IMAGE_NAME }}-api-legacy:edge
cache-to: type=inline
- name: Build and push Docker image (api)
uses: docker/build-push-action@v5
with:
context: ./src/api
push: true
build-args: |
VERSION=${{ env.VERSION }}
REVISION=${{ env.REVISION }}
tags: ${{ steps.meta-api.outputs.tags }}
labels: ${{ steps.meta-api.outputs.labels }}
cache-from: type=registry,ref=${{ env.BASE_IMAGE_NAME }}-api:edge
cache-to: type=inline
- name: Build and push Docker image (client)
uses: docker/build-push-action@v5
with:
context: ./src/client
target: deploy
push: true
build-args: |
VERSION=${{ env.VERSION }}
REVISION=${{ env.REVISION }}
tags: ${{ steps.meta-client.outputs.tags }}
labels: ${{ steps.meta-client.outputs.labels }}
cache-from: type=registry,ref=${{ env.BASE_IMAGE_NAME }}-client:edge
cache-to: type=inline
- name: Build and push Docker image (view-sync)
uses: docker/build-push-action@v5
with:
context: ./src/view-sync
push: true
build-args: |
VERSION=${{ env.VERSION }}
REVISION=${{ env.REVISION }}
tags: ${{ steps.meta-view-sync.outputs.tags }}
labels: ${{ steps.meta-view-sync.outputs.labels }}
cache-from: type=registry,ref=${{ env.BASE_IMAGE_NAME }}-view-sync:edge
cache-to: type=inline
patch-changelog:
runs-on: ubuntu-latest
name: Patch CHANGELOG.md and update GitHub release notes
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set environment variables
run: |
echo GIT_BRANCH_NAME=mark-version-${TAG_NAME#v}-as-released >> $GITHUB_ENV
echo GIT_COMMIT_MESSAGE=Mark version ${TAG_NAME#v} as released >> $GITHUB_ENV
echo RELEASE_ID=$(gh api -H "Accept: application/vnd.github+json" /repos/${GITHUB_REPOSITORY}/releases/tags/${TAG_NAME} | jq '.id') >> $GITHUB_ENV
- name: Get changelog for this specific release and update release notes
run: |
gh api \
--method PATCH \
--header "Accept: application/vnd.github+json" \
/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID} \
-f body="$(./get-changelog.sh)"
- name: Checkout new branch and patch changelog
run: |
git checkout -b $GIT_BRANCH_NAME
sed -i "/^\#\# \[Unreleased\]$/a \\\n\#\# $TAG_NAME - $(date '+%Y-%m-%d')" CHANGELOG.md
- name: Commit, push and create pull request
run: |
git config --global user.email "office@geowerkstatt.ch"
git config --global user.name "GeoWerkstatt-Build"
git commit -am "$GIT_COMMIT_MESSAGE"
git push --set-upstream origin $GIT_BRANCH_NAME
gh pr create --title "$GIT_COMMIT_MESSAGE" --body ""