forked from jlelse/GoBlog
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (72 loc) · 1.98 KB
/
Copy pathdocker.yml
File metadata and controls
76 lines (72 loc) · 1.98 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
name: Main workflow
on:
push:
branches: ["**"]
pull_request:
branches: ["**"]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run tests in Docker (test stage)
uses: docker/build-push-action@v6
with:
target: test
tags: test
push: false
build:
if: github.ref == 'refs/heads/master'
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Gitea container registry
uses: docker/login-action@v3
with:
registry: git.jlel.se
username: nologin
password: ${{ secrets.GITEA_TOKEN }}
- name: Build base image
uses: docker/build-push-action@v6
with:
push: true
target: base
tags: ghcr.io/jlelse/goblog:latest,git.jlel.se/jlelse/goblog:latest
provenance: false
- name: Build tools image
uses: docker/build-push-action@v6
with:
push: true
target: tools
tags: ghcr.io/jlelse/goblog:tools,git.jlel.se/jlelse/goblog:tools
provenance: false
cleanup:
if: github.ref == 'refs/heads/master'
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/delete-package-versions@v5
with:
package-name: ${{ github.event.repository.name }}
owner: ${{ github.repository_owner }}
package-type: 'container'
min-versions-to-keep: 0
delete-only-untagged-versions: 'true'