-
Notifications
You must be signed in to change notification settings - Fork 8
88 lines (77 loc) · 2.9 KB
/
docker-oauth-dui.yml
File metadata and controls
88 lines (77 loc) · 2.9 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
name: "Docker Build and Push (OAuth Discovery UI)"
on:
push:
branches: [main, master]
paths:
- 'client-oauth-discovery-dui/**'
- '.github/workflows/docker-oauth-dui.yml'
release:
types: [published]
schedule:
# Weekly rebuild every Thursday at 3:00 AM UTC to get latest base image updates
- cron: '0 3 * * 4'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/client-oauth-discovery-dui
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Check build trigger
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
echo "🔄 This is a scheduled weekly rebuild to update base images"
elif [ "${{ github.event_name }}" = "release" ]; then
echo "🚀 This is a release build"
else
echo "📦 This is a regular build triggered by push"
fi
- name: Log in to Container Registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# For pushes to master/main branch or scheduled builds, tag as "latest"
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event_name == 'schedule' }}
# For releases, create semantic version tags
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
org.opencontainers.image.title=OSLC Client OAuth Discovery DUI
org.opencontainers.image.description=OSLC Client OAuth Discovery Delegated UI Sample
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: ./client-oauth-discovery-dui
file: ./client-oauth-discovery-dui/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
# For scheduled builds, don't use cache to ensure fresh base images
no-cache: ${{ github.event_name == 'schedule' }}
pull: true
- name: Output image details
run: |
echo "Image has been pushed to:"
echo "${{ steps.meta.outputs.tags }}" | while read -r tag; do
echo " - $tag"
done