|
| 1 | +# Release builds and publish a new release. |
| 2 | +# 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). |
| 3 | + |
| 4 | +name: Release |
| 5 | + |
| 6 | +on: |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + nextVersion: |
| 10 | + description: 'specify the release version in the semver format v[major].[minor].[patch] e.g. v0.0.0' |
| 11 | + required: true |
| 12 | + |
| 13 | +# base permissions for all jobs should be minimal |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +env: |
| 18 | + REGISTRY: ghcr.io/openmcp-project |
| 19 | + IMAGE_NAME: mcp-ui-frontend |
| 20 | + |
| 21 | +jobs: |
| 22 | + run-build: |
| 23 | + uses: ./.github/workflows/build.yaml |
| 24 | + |
| 25 | + release: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + needs: |
| 28 | + - run-build |
| 29 | + |
| 30 | + permissions: |
| 31 | + contents: write # write release tag to the repo |
| 32 | + packages: write # push the container to ghcr |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout code |
| 36 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 37 | + with: |
| 38 | + fetch-depth: 0 # Fetch all history for all tags and branches |
| 39 | + |
| 40 | + - name: Check if tag already exists |
| 41 | + id: check_tag |
| 42 | + run: | |
| 43 | + if git rev-parse ${{ github.event.inputs.nextVersion }} >/dev/null 2>&1 |
| 44 | + then |
| 45 | + echo "Tag ${{ github.event.inputs.nextVersion }} already exists." |
| 46 | + exit 1 |
| 47 | + else |
| 48 | + echo "Tag does not exit. Building release version ${{ github.event.inputs.nextVersion }}" |
| 49 | + fi |
| 50 | + |
| 51 | + - name: Log in to the Container registry |
| 52 | + uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0 |
| 53 | + with: |
| 54 | + registry: ${{ env.REGISTRY }} |
| 55 | + username: ${{ github.actor }} |
| 56 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + |
| 58 | + - name: Build and push Docker image |
| 59 | + id: push |
| 60 | + uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0 |
| 61 | + with: |
| 62 | + context: . |
| 63 | + push: true |
| 64 | + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.nextVersion }} |
| 65 | + |
| 66 | + - name: Create Release with autogenerated release notes |
| 67 | + env: |
| 68 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + run: | |
| 70 | + gh release create ${{ github.event.inputs.nextVersion }} \ |
| 71 | + --generate-notes \ |
| 72 | + --target ${{ github.sha }} |
0 commit comments