Skip to content

Commit 2c0220f

Browse files
authored
Merge pull request #39 from ponkio-o/added-docker-push
ci: added build and push container image
2 parents 712bcc7 + df11751 commit 2c0220f

File tree

3 files changed

+105
-127
lines changed

3 files changed

+105
-127
lines changed

.github/workflows/release.yml

+105
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
# Build first because some Dockerfiles depend on the builder image
10+
build-and-push-builder:
11+
name: Build and push container image (builder)
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
steps:
17+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
18+
with:
19+
submodules: recursive
20+
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
26+
27+
- name: Login to ghcr.io
28+
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Build and push
35+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
36+
with:
37+
platforms: linux/amd64,linux/arm64
38+
file: build.Dockerfile
39+
tags: |
40+
ghcr.io/dena/unity-meta-check/unity-meta-check-builder:${{ github.ref_name }}
41+
ghcr.io/dena/unity-meta-check/unity-meta-check-builder:latest
42+
push: true
43+
cache-from: type=gha
44+
cache-to: type=gha,mode=max
45+
46+
build-and-push:
47+
name: Build and push container image
48+
needs: build-and-push-builder
49+
runs-on: ubuntu-latest
50+
permissions:
51+
contents: read
52+
53+
strategy:
54+
matrix:
55+
images:
56+
- dockerfile: ./Dockerfile
57+
image_name: ghcr.io/dena/unity-meta-check/unity-meta-check
58+
- dockerfile: ./.github/images/Dockerfile
59+
image_name: ghcr.io/dena/unity-meta-check/unity-meta-check-gh-action
60+
- dockerfile: ./.circleci/images/Dockerfile
61+
image_name: ghcr.io/dena/unity-meta-check/unity-meta-check-circleci
62+
63+
steps:
64+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
65+
with:
66+
submodules: recursive
67+
68+
- uses: nowsprinting/check-version-format-action@98485692a883d962227b09f40f29a63de0771299 # v4.0.2
69+
id: version
70+
with:
71+
prefix: "v"
72+
73+
- name: Set up QEMU
74+
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
75+
76+
- name: Set up Docker Buildx
77+
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
78+
79+
- name: Login to ghcr.io
80+
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
81+
with:
82+
registry: ghcr.io
83+
username: ${{ github.actor }}
84+
password: ${{ secrets.GITHUB_TOKEN }}
85+
86+
- name: Build and push
87+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
88+
with:
89+
platforms: linux/amd64,linux/arm64
90+
file: ${{ matrix.images.dockerfile }}
91+
tags: ${{ matrix.images.image_name }}:${{ github.ref_name }}
92+
push: true
93+
cache-from: type=gha
94+
cache-to: type=gha,mode=max
95+
96+
- name: Add latest tag
97+
if: steps.version.outputs.is_stable == 'true'
98+
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
99+
with:
100+
platforms: linux/amd64,linux/arm64
101+
file: ${{ matrix.images.dockerfile }}
102+
tags: ${{ matrix.images.image_name }}:latest
103+
push: true
104+
cache-from: type=gha
105+
cache-to: type=gha,mode=max

scripts/deploy

-9
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ usage: deploy [<options>]
2929
3030
OPTIONS
3131
-h, --help print this usage
32-
--latest also tag the docker image as the latest
3332
EOS
3433
}
3534

@@ -43,8 +42,6 @@ usage-error() {
4342

4443

4544
main() {
46-
local arg="${1:-}"
47-
4845
has go || throw "'go' must be installed (see https://golang.org)"
4946
has gh || throw "'gh' must be installed (see https://cli.github.com)"
5047
has docker || throw "'docker' must be installed (see https://www.docker.com)"
@@ -65,12 +62,6 @@ main() {
6562
(cd "$BASE_DIR"
6663
./scripts/deploy-gh-release
6764
./scripts/deploy-bins
68-
69-
if [[ "$arg" == "--latest" ]]; then
70-
./scripts/deploy-images --latest
71-
else
72-
./scripts/deploy-images
73-
fi
7465
)
7566
}
7667

scripts/deploy-images

-118
This file was deleted.

0 commit comments

Comments
 (0)