-
Notifications
You must be signed in to change notification settings - Fork 0
125 lines (111 loc) · 4.22 KB
/
Copy pathrelease.yaml
File metadata and controls
125 lines (111 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
---
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