-
Notifications
You must be signed in to change notification settings - Fork 2
142 lines (129 loc) · 4.93 KB
/
main.yml
File metadata and controls
142 lines (129 loc) · 4.93 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Publish Docker images
on:
push:
tags:
- "*"
env:
REGISTRY: ghcr.io
REPOSITORY_OWNER: supinf
jobs:
build-and-push:
name: Build ${{ matrix.image_name }}:${{ matrix.image_tag }}
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- image_name: vscode-devcontainer
image_tag: 20260504
filter_ref: gh-devcontainer
dockerfile_path: vscode-devcontainer/versions/node25/
platforms: linux/amd64,linux/arm64
- image_name: vscode-devcontainer
image_tag: go-20260504
filter_ref: gh-devcontainer
dockerfile_path: vscode-devcontainer/versions/go1.26-node25/
platforms: linux/amd64,linux/arm64
- image_name: shellcheck
image_tag: 0.7
filter_ref: gh-shellcheck
dockerfile_path: haskell/shellcheck/versions/0.x/
- image_name: hadolint
image_tag: 1.19
filter_ref: gh-hadolint
dockerfile_path: haskell/hadolint/versions/1.19/
- image_name: awscli
image_tag: 1.18
filter_ref: gh-awscli-v1.18
dockerfile_path: python/awscli/versions/1.18/
- image_name: awscli
image_tag: 2.4
filter_ref: gh-awscli-v2.4
dockerfile_path: python/awscli/versions/2.4/
- image_name: go-swagger
image_tag: 0.25
filter_ref: gh-go-swagger
dockerfile_path: golang/swagger/versions/0.x/
- image_name: hugo
image_tag: 0.79
filter_ref: gh-hugo
dockerfile_path: golang/hugo/versions/0.x/
- image_name: cfn-lint
image_tag: 0.58
filter_ref: gh-cfn-lint
dockerfile_path: python/cfn-lint/versions/0.58/
- image_name: test-http
image_tag: 1.2
filter_ref: gh-test-http
dockerfile_path: python/test-http/versions/1.2/
- image_name: x-ray
image_tag: 3.2
filter_ref: gh-x-ray
dockerfile_path: golang/x-ray/versions/3.2/
- image_name: swagger-codegen
image_tag: 3.0
filter_ref: gh-swagger-codegen-v3.0
dockerfile_path: java/swagger-codegen/versions/3.0
platforms: linux/amd64,linux/arm64
- image_name: swagger-codegen
image_tag: 2.4
filter_ref: gh-swagger-codegen-v2.4
dockerfile_path: java/swagger-codegen/versions/2.4
platforms: linux/amd64,linux/arm64
- image_name: postgres-backup
image_tag: 9.6
filter_ref: gh-postgres-backup
dockerfile_path: cli-tools/postgres-backup/versions/9.6/
steps:
- name: Delete huge unnecessary tools folder
run: rm -rf /opt/hostedtoolcache
# Docker ボリュームの調整
- name: Adjutment docker volumes
run: |
docker system df
docker system prune -a --volumes -f
docker system df
# Checkout repository
- name: Checkout repository
if: contains(github.ref, matrix.filter_ref)
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
# QEMU: arm64 ビルド用
- name: Set up QEMU
if: contains(github.ref, matrix.filter_ref) && matrix.platforms
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3
- name: Set up Docker Buildx
if: contains(github.ref, matrix.filter_ref)
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3
# Login: GITHUB_TOKEN を使用
- name: Log in to the Container registry
if: contains(github.ref, matrix.filter_ref)
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# タグ生成・ラベル付与
- name: Extract metadata (tags, labels) for Docker
if: contains(github.ref, matrix.filter_ref)
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5
with:
images: ${{ env.REGISTRY }}/${{ env.REPOSITORY_OWNER }}/${{ matrix.image_name }}
tags: |
type=raw,value=${{ matrix.image_tag }}
type=sha,format=long
# Build & Push
- name: Build and push Docker image
if: contains(github.ref, matrix.filter_ref)
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6
with:
context: ${{ matrix.dockerfile_path }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.platforms }}
cache-from: type=gha
cache-to: type=gha,mode=max