Release #2
This file contains hidden or 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
# Release builds and publish a new release. | |
# It will run necessary tests. Then it builds the docker image, pushes it to the container registry, and creates a new Github Release (and git tag) with automated release notes (automated release notes powered by GitHub). | |
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
nextVersion: | |
description: 'specify the release version in the semver format v[major].[minor].[patch] e.g. v0.0.0' | |
required: true | |
# base permissions for all jobs should be minimal | |
permissions: | |
contents: read | |
env: | |
REGISTRY: ghcr.io/openmcp-project | |
IMAGE_NAME: mcp-ui-frontend | |
jobs: | |
run-build: | |
uses: ./.github/workflows/build.yaml | |
release: | |
runs-on: ubuntu-latest | |
needs: | |
- run-build | |
permissions: | |
contents: write # write release tag to the repo | |
packages: write # push the container to ghcr | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 0 # Fetch all history for all tags and branches | |
- name: Check if tag already exists | |
id: check_tag | |
run: | | |
if git rev-parse ${{ github.event.inputs.nextVersion }} >/dev/null 2>&1 | |
then | |
echo "Tag ${{ github.event.inputs.nextVersion }} already exists." | |
exit 1 | |
else | |
echo "Tag does not exit. Building release version ${{ github.event.inputs.nextVersion }}" | |
fi | |
- name: Log in to the Container registry | |
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.nextVersion }} | |
- name: Create Release with autogenerated release notes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create ${{ github.event.inputs.nextVersion }} \ | |
--generate-notes \ | |
--target ${{ github.sha }} |