-
Notifications
You must be signed in to change notification settings - Fork 2
99 lines (88 loc) · 3.02 KB
/
Copy pathdeploy.yml
File metadata and controls
99 lines (88 loc) · 3.02 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
name: Deploy
on:
push:
branches:
- main
paths:
- .dockerignore
- .github/workflows/deploy.yml
- .github/workflows/renovate-global.js
- StartSCH.slnx
- StartSch.Tests/**
- StartSch.Wasm/**
- StartSch/**
- global.json
jobs:
build-and-push:
name: Build and push Docker image
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
# Generate Docker tags, labels and annotations
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/startsch
tags: |
# Tag the Docker image using a version created from the GitHub action run number.
# Using the Git hash as the tag does not work because Renovate does not know how to find the latest version.
# Using just :latest with a @sha256:IMAGE_HASH does not work as digest updates do not add a GitHub diff link to the Renovate PR for some reason.
type=raw,value=v0.0.${{ github.run_number }}
# Add latest tag
type=raw,value=latest
# Tag with Git commit hash
type=sha,format=long
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
file: ./StartSch/Dockerfile
push: true
# Apply the generated metadata
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha
cache-to: type=gha,mode=max
# Renovate needs a Git tag to show a GitHub diff link
- name: Create Git tag
run: |
TAG_NAME="v0.0.${{ github.run_number }}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "$TAG_NAME"
git push origin "$TAG_NAME"
update-k8s:
name: Update kir-dev/k8s
runs-on: ubuntu-latest
needs: build-and-push
permissions:
contents: read
steps:
- name: Checkout Renovate config
uses: actions/checkout@v6
with:
sparse-checkout: .github/workflows/renovate-global.js
sparse-checkout-cone-mode: false
- name: Update kir-dev/k8s
uses: renovatebot/github-action@v46.0.0
with:
configurationFile: .github/workflows/renovate-global.js
token: ${{ secrets.KIR_DEV_BOT_PAT }}
env:
LOG_LEVEL: debug
RENOVATE_TOKEN: ${{ secrets.KIR_DEV_BOT_PAT }}