-
Notifications
You must be signed in to change notification settings - Fork 8
146 lines (123 loc) · 4.77 KB
/
release.yml
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
143
144
145
146
name: Release
on:
push:
tags:
- "v*"
jobs:
# Build first because some Dockerfiles depend on the builder image
build-and-push-builder:
name: Build and push container image (builder)
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Login to ghcr.io
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
platforms: linux/amd64,linux/arm64
file: build.Dockerfile
tags: |
ghcr.io/dena/unity-meta-check/unity-meta-check-builder:${{ github.ref_name }}
ghcr.io/dena/unity-meta-check/unity-meta-check-builder:latest
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-and-push:
name: Build and push container image
needs: build-and-push-builder
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
images:
- dockerfile: ./Dockerfile
image_name: ghcr.io/dena/unity-meta-check/unity-meta-check
- dockerfile: ./.github/images/Dockerfile
image_name: ghcr.io/dena/unity-meta-check/unity-meta-check-gh-action
- dockerfile: ./.circleci/images/Dockerfile
image_name: ghcr.io/dena/unity-meta-check/unity-meta-check-circleci
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
submodules: recursive
- uses: nowsprinting/check-version-format-action@98485692a883d962227b09f40f29a63de0771299 # v4.0.2
id: version
with:
prefix: "v"
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0
- name: Login to ghcr.io
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
platforms: linux/amd64,linux/arm64
file: ${{ matrix.images.dockerfile }}
tags: ${{ matrix.images.image_name }}:${{ github.ref_name }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Add latest tag
if: steps.version.outputs.is_stable == 'true'
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
platforms: linux/amd64,linux/arm64
file: ${{ matrix.images.dockerfile }}
tags: ${{ matrix.images.image_name }}:latest
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
release-binaries:
name: Build and release binaries
runs-on: ubuntu-latest
permissions:
# Required to write release assets
contents: write
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
submodules: recursive
- name: Install aqua
uses: aquaproj/aqua-installer@4551ec64e21bf0f557c2525135ff0bd2cba40ec7 # v3.0.0
with:
aqua_version: v2.27.3
- uses: nowsprinting/check-version-format-action@98485692a883d962227b09f40f29a63de0771299 # v4.0.2
id: version
with:
prefix: "v"
- name: Create pre-release
if: steps.version.outputs.is_stable != 'true'
run: gh release create --prerelease --title ${{ github.ref_name }} ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release
if: steps.version.outputs.is_stable == 'true'
run: gh release create --latest --title ${{ github.ref_name }} ${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run goreleaser
run: goreleaser release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}