-
Notifications
You must be signed in to change notification settings - Fork 3
140 lines (134 loc) · 5.32 KB
/
build.yaml
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
##################################################################################
# References:
# Built-in arguments:
# - https://docs.github.com/en/actions/learn-github-actions/contexts
# Built-in environment variables:
# - https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/variables#default-environment-variables
#
# Develop this workflow locally with the following command:
# ~$ gh extension install nektos/gh-act
# ~$ gh act --env-file .env -s GITHUB_TOKEN=$GITHUB_TOKEN -s PULUMI_ACCESS_TOKEN=$PULUMI_ACCESS_TOKEN
name: Pulumi Devcontainer Build
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- 'devcontainer**'
- 'devcontainer/**'
- '.devcontainer/**'
- '.pulumi/**'
- '.kube/**'
- 'docs/**'
- '**.md'
pull_request:
paths-ignore:
- 'devcontainer**'
- 'devcontainer/**'
- '.devcontainer/**'
- '.pulumi/**'
- '.kube/**'
- 'docs/**'
- '**.md'
branches:
- main
schedule:
- cron: '0 0 * * 0'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
actions: write
steps:
-
name: Git Checkout
uses: actions/checkout@v4
id: git
with:
ref: 'main'
submodules: 'recursive'
clean: ''
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
id: qemu
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
id: buildx
-
name: Login to GitHub Container Registry
id: login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: repository_owner to lower case
id: repository_owner
uses: Entepotenz/change-string-case-action-min-dependencies@v1
with:
string: ${{ github.repository_owner }}
-
name: repository to lower case
id: repository
uses: Entepotenz/change-string-case-action-min-dependencies@v1
with:
string: ${{ github.repository }}
-
name: Build Container Image
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
uses: docker/build-push-action@v5
with:
push: false
cache-from: |
type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:build-cache
type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:latest
cache-to: type=inline,mode=max
context: ./docker
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}"
-
name: Push Container Image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
push: true
cache-from: |
type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:build-cache
type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:latest
cache-to: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:build-cache,mode=max
context: ./docker
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}"
# -
# name: Build Container Image
# if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref != 'refs/heads/main')
# uses: docker/build-push-action@v5
# with:
# push: false
# cache-from: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:latest
# cache-to: type=inline
# context: ./docker
# file: ./docker/Dockerfile
# platforms: linux/amd64,linux/arm64
# tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}"
#
# -
# name: Push Container Image
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# uses: docker/build-push-action@v5
# with:
# push: true
# cache-from: type=registry,ref=ghcr.io/${{ steps.repository.outputs.lowercase }}:latest
# cache-to: type=inline
# context: ./docker
# file: ./docker/Dockerfile
# platforms: linux/amd64,linux/arm64
# tags: "ghcr.io/${{ steps.repository.outputs.lowercase }}:latest,ghcr.io/${{ steps.repository.outputs.lowercase }}:${{ github.sha }}"