fix: revert #644 #194
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
name: 'Release' | |
on: | |
pull_request: | |
types: [ closed ] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
REPO_NAME: ${{ github.event.repository.name }} | |
jobs: | |
calculate-semver: | |
runs-on: ubuntu-latest | |
if: | | |
github.event.pull_request.merged == true && | |
(contains(github.event.pull_request.labels.*.name, 'major') || contains(github.event.pull_request.labels.*.name, 'minor') || contains(github.event.pull_request.labels.*.name, 'patch')) | |
outputs: | |
version: ${{steps.calculate.outputs.version}} | |
steps: | |
- name: Parse the SemVer label | |
id: label | |
uses: UKHomeOffice/match-label-action@v1 | |
with: | |
labels: minor,major,patch | |
mode: singular | |
- name: Calculate SemVer value | |
id: calculate | |
uses: UKHomeOffice/semver-calculate-action@v1 | |
with: | |
increment: ${{ steps.label.outputs.matchedLabels }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
default_to_highest: ${{ github.base_ref == 'main' }} | |
container-image: | |
needs: calculate-semver | |
uses: ./.github/workflows/build-container-image.yml | |
with: | |
imageRegistry: ghcr.io | |
imageName: ${{ github.repository }} | |
imageBuildContext: ./monitoring-as-code | |
repositoryName: ${{ github.event.repository.name }} | |
promtoolImageName: sre-promtool | |
promtoolVersion: 2.38.0 | |
user: ho-cto | |
tag: ${{needs.calculate-semver.outputs.version}} | |
tag_latest: ${{ github.base_ref == 'main' }} | |
secrets: inherit | |
container-image-push: | |
needs: container-image | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Download artifact | |
uses: actions/[email protected] | |
with: | |
name: ${{ env.REPO_NAME }} | |
path: /tmp | |
- name: Load Docker image | |
run: | | |
docker load --input /tmp/${{ env.REPO_NAME }}.tar | |
- name: Login to GitHub Container Registry | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push image to GitHub Container Registry | |
run: | | |
for i in $(docker image list --format '{{.Repository}}:{{.Tag}}' "${1}" | grep "sre-monitoring-as-code"); do | |
echo "${1}$i" | |
docker push "${1}$i" | |
done | |
tag-repo-semver: | |
needs: [calculate-semver, container-image-push] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Tag repository with SemVer | |
uses: UKHomeOffice/semver-tag-action@v3 | |
with: | |
tag: ${{needs.calculate-semver.outputs.version}} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
draft-release-notes: | |
needs: tag-repo-semver | |
runs-on: ubuntu-latest | |
steps: | |
- name: Draft release notes | |
uses: release-drafter/release-drafter@v6 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |