-
Notifications
You must be signed in to change notification settings - Fork 227
57 lines (47 loc) · 1.71 KB
/
Copy pathdocker-release.yml
File metadata and controls
57 lines (47 loc) · 1.71 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
name: Docker Release
# only run this on merge to main
# clone the repo
# set the VERSION environment variable ie `cat packages/runtime/package.json | jq -r '.version'`
# use `docker manifest inspect ohmjs/ohm:$VERION` to verify that the release doesn't already exist before running the rest of the workflow
# create a multi platfrom builder
# build and push the image
on:
push:
branches: [main, docker-release-gha]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get version
id: version
run: |
echo "VERSION=$(cat packages/runtime/package.json | jq -r '.version')" >> "$GITHUB_OUTPUT"
- name: Check if image already exists
id: check
run: |
if docker manifest inspect ohmjs/ohm:${{ steps.version.outputs.VERSION }} > /dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Set up QEMU
if: steps.check.outputs.exists == 'false'
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
if: steps.check.outputs.exists == 'false'
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
if: steps.check.outputs.exists == 'false'
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
if: steps.check.outputs.exists == 'false'
uses: docker/bake-action@v7
with:
files: docker/docker-compose.yml
push: true
env:
VERSION: ${{ steps.version.outputs.VERSION }}