Release #53
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
| --- | |
| 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@main | |
| with: | |
| runs-on: ubuntu-latest | |
| stage-image: false | |
| push-kustomize: false | |
| secrets: inherit # pragma: allowlist secret | |
| 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@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}" | |
| # --- Container image --- | |
| - name: Build & push image (version tag) | |
| if: steps.meta.outputs.version != '' | |
| uses: dagger/dagger-for-github@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-kubeconfig | |
| --tag ${{ steps.meta.outputs.version }} | |
| --registry-url ghcr.io | |
| --registry-username env:GITHUB_ACTOR | |
| --registry-password env:GITHUB_TOKEN | |
| --dockerfile cluster/images/provider-kubeconfig/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@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-kubeconfig | |
| --tag latest | |
| --registry-url ghcr.io | |
| --registry-username env:GITHUB_ACTOR | |
| --registry-password env:GITHUB_TOKEN | |
| --dockerfile cluster/images/provider-kubeconfig/Dockerfile | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| DAGGER_CLOUD_TOKEN: ${{ secrets.DAGGER_CLOUD_TOKEN }} | |
| # --- Crossplane xpkg --- | |
| - 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-kubeconfig:${{ 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-kubeconfig:${{ steps.meta.outputs.version }} \ | |
| -o provider-kubeconfig.xpkg | |
| - name: Push xpkg (version tag) | |
| if: steps.meta.outputs.version != '' | |
| run: | | |
| crossplane xpkg push \ | |
| "ghcr.io/stuttgart-things/provider-kubeconfig-xpkg:${{ steps.meta.outputs.version }}" \ | |
| -f provider-kubeconfig.xpkg | |
| - name: Push xpkg (latest tag) | |
| if: steps.meta.outputs.version != '' | |
| run: | | |
| crossplane xpkg push \ | |
| "ghcr.io/stuttgart-things/provider-kubeconfig-xpkg:latest" \ | |
| -f provider-kubeconfig.xpkg |