-
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (47 loc) · 1.51 KB
/
docker-image.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
name: Docker Image
on:
push:
branches: [ "main" ]
tags: [ "v*.*.*" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: docker/setup-buildx-action@v2
- name: Build Docker image
uses: docker/build-push-action@v3
with:
tags: d3xs
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
UPDATE_CHECK_COMMIT=${{ github.sha }}
- name: Test the Docker image
run: |
docker run --rm d3xs --help
- name: Login to github container registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push the image to `edge`
if: github.event_name == 'push' && github.ref_name == 'main'
run: |
docker tag d3xs ghcr.io/${{ github.repository }}:edge
docker push ghcr.io/${{ github.repository }}:edge
- name: Push the image to `${{ github.ref_name }}`
if: github.ref_type == 'tag'
run: |
docker tag d3xs ghcr.io/${{ github.repository }}:${{ github.ref_name }}
docker push ghcr.io/${{ github.repository }}:${{ github.ref_name }}
- name: Push the image to `latest`
if: github.ref_type == 'tag'
run: |
docker tag d3xs ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:latest