Skip to content

Release

Release #43

Workflow file for this run

---
name: Release
on:
workflow_run:
workflows: ["Build, Push & Scan Container Image"]
types: [completed]
branches: [main]
workflow_dispatch:
jobs:
semantic-release:
name: Semantic Release
if: >-
github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success'
uses: stuttgart-things/github-workflow-templates/.github/workflows/call-go-release.yaml@ac728484cefce72ff49281ccdea321d1dbe9f766 # main
with:
runs-on: ubuntu-latest
stage-image: false
push-kustomize: false
secrets: inherit
publish:
name: Publish Image & xpkg to GHCR
needs: semantic-release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
submodules: true
fetch-depth: 0
- name: Get latest version tag
id: meta
run: |
git fetch --tags
VERSION=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1)
COMMIT=$(git rev-parse --short HEAD)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "commit=${COMMIT}" >> $GITHUB_OUTPUT
echo "Latest version: ${VERSION}, commit: ${COMMIT}"
- name: Build & push image (version tag)
if: steps.meta.outputs.version != ''
uses: dagger/dagger-for-github@27b130bf0f79a7f6fbbbe0fbca6760dc9bb40a77 # v8.4.1
with:
version: "0.20.0"
verb: call
module: github.com/stuttgart-things/blueprints/kubernetes-microservice@v1.71.0
args: >-
bake-image
--src .
--repository-name stuttgart-things/provider-vspherevm
--tag ${{ steps.meta.outputs.version }}
--registry-url ghcr.io
--registry-username env:GITHUB_ACTOR
--registry-password env:GITHUB_TOKEN
--dockerfile cluster/images/provider-vspherevm/Dockerfile
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }}
- name: Build & push image (latest tag)
uses: dagger/dagger-for-github@27b130bf0f79a7f6fbbbe0fbca6760dc9bb40a77 # v8.4.1
with:
version: "0.20.0"
verb: call
module: github.com/stuttgart-things/blueprints/kubernetes-microservice@v1.71.0
args: >-
bake-image
--src .
--repository-name stuttgart-things/provider-vspherevm
--tag latest
--registry-url ghcr.io
--registry-username env:GITHUB_ACTOR
--registry-password env:GITHUB_TOKEN
--dockerfile cluster/images/provider-vspherevm/Dockerfile
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_ACTOR: ${{ github.actor }}
DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }}
- name: Login to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- name: Install Crossplane CLI
run: |
curl -fsSL "https://raw.githubusercontent.com/crossplane/crossplane/master/install.sh" | sh
sudo mv crossplane /usr/local/bin/
- name: Pull runtime image
if: steps.meta.outputs.version != ''
run: docker pull ghcr.io/stuttgart-things/provider-vspherevm:${{ steps.meta.outputs.version }}
- name: Build xpkg
if: steps.meta.outputs.version != ''
run: |
crossplane xpkg build \
--package-root=package \
--embed-runtime-image=ghcr.io/stuttgart-things/provider-vspherevm:${{ steps.meta.outputs.version }} \
-o provider-vspherevm.xpkg
- name: Push xpkg (version tag)
if: steps.meta.outputs.version != ''
run: |
crossplane xpkg push \
"ghcr.io/stuttgart-things/provider-vspherevm-xpkg:${{ steps.meta.outputs.version }}" \
-f provider-vspherevm.xpkg
- name: Push xpkg (latest tag)
if: steps.meta.outputs.version != ''
run: |
crossplane xpkg push \
"ghcr.io/stuttgart-things/provider-vspherevm-xpkg:latest" \
-f provider-vspherevm.xpkg