Repository navigation
219 lines (196 loc) · 6.63 KB
/
Copy pathrelease.yml
File metadata and controls
219 lines (196 loc) · 6.63 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to build (e.g. v1.0.0)'
required: true
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.image }} (${{ matrix.platform }})
runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || 'ubuntu-24.04-arm' }}
strategy:
fail-fast: false
matrix:
image:
- nexploy
- docker-api
platform:
- linux/amd64
- linux/arm64
include:
- image: nexploy
dockerfile: apps/nexploy/Dockerfile
- image: docker-api
dockerfile: apps/docker-api/Dockerfile
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Prepare platform tag
id: platform
run: echo "pair=${platform//\//-}" >> "$GITHUB_OUTPUT"
env:
platform: ${{ matrix.platform }}
- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
push: true
outputs: type=image,name=nexploy/${{ matrix.image }},push-by-digest=true,name-canonical=true
cache-from: type=gha,scope=${{ matrix.image }}-${{ steps.platform.outputs.pair }}
cache-to: type=gha,mode=max,scope=${{ matrix.image }}-${{ steps.platform.outputs.pair }}
- name: Export digest
run: |
mkdir -p /tmp/digests/${{ matrix.image }}
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${{ matrix.image }}/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ matrix.image }}-${{ steps.platform.outputs.pair }}
path: /tmp/digests/${{ matrix.image }}/*
if-no-files-found: error
retention-days: 1
images:
name: Publish ${{ matrix.image }}
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: nexploy
readme: apps/nexploy/DOCKERHUB.md
- image: docker-api
readme: apps/docker-api/DOCKERHUB.md
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests/${{ matrix.image }}
pattern: digests-${{ matrix.image }}-*
merge-multiple: true
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: nexploy/${{ matrix.image }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }}
- name: Create manifest list and push
working-directory: /tmp/digests/${{ matrix.image }}
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf 'nexploy/${{ matrix.image }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect nexploy/${{ matrix.image }}:${{ steps.meta.outputs.version }}
- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: nexploy/${{ matrix.image }}
readme-filepath: ${{ matrix.readme }}
release:
name: GitHub release
needs: images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Resolve tags
id: tags
env:
GIT_TAG: ${{ github.event.inputs.tag || github.ref_name }}
run: |
echo "git=${GIT_TAG}" >> "$GITHUB_OUTPUT"
echo "image=${GIT_TAG#v}" >> "$GITHUB_OUTPUT"
- name: Generate changelog
env:
GIT_TAG: ${{ steps.tags.outputs.git }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node scripts/generate-changelog.mjs "$GIT_TAG"
- name: Build release notes
env:
IMAGE_TAG: ${{ steps.tags.outputs.image }}
GIT_TAG: ${{ steps.tags.outputs.git }}
run: |
{
echo "# Nexploy ${IMAGE_TAG}"
echo
cat /tmp/changelog.md
echo
echo "## Docker images"
echo
echo '```'
echo "docker pull nexploy/nexploy:${IMAGE_TAG}"
echo "docker pull nexploy/docker-api:${IMAGE_TAG}"
echo '```'
echo
echo "## Install"
echo
echo '```bash'
echo "curl -fsSL https://nexploy.app/install.sh | sh"
echo '```'
echo
echo "Or pin this exact version:"
echo
echo '```bash'
echo "NEXPLOY_VERSION=${GIT_TAG} \\"
echo " sh -c \"\$(curl -fsSL https://nexploy.app/install.sh)\""
echo '```'
echo
echo "Already running Nexploy?"
echo
echo '```bash'
echo "curl -fsSL https://nexploy.app/install.sh | sh -s update"
echo '```'
if [ -s /tmp/changelog-footer.md ]; then
echo
cat /tmp/changelog-footer.md
fi
} > /tmp/release-notes.md
- name: Drop stale release
env:
GIT_TAG: ${{ steps.tags.outputs.git }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release delete "$GIT_TAG" --yes --repo "$GITHUB_REPOSITORY" || true
- name: Create release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ steps.tags.outputs.git }}
body_path: /tmp/release-notes.md