-
Notifications
You must be signed in to change notification settings - Fork 9
43 lines (40 loc) · 1.2 KB
/
docker.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
name: "Docker build"
on:
push:
branches:
- master
tags:
- 'v*'
jobs:
docker-push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: earthly/[email protected]
with:
version: latest
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: docker_meta
with:
images: ghcr.io/kesin11/ci_analyzer
sep-tags: ","
tags: |
type=ref,event=branch
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}
type=semver,pattern=v{{major}}.{{minor}}
- name: Login to ghcr
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker build and push latest tag
run: |
TAGS=$(echo "${{ steps.docker_meta.outputs.tags }}" | tr ',' ' ')
earthly --strict --push --max-remote-cache \
--remote-cache=ghcr.io/kesin11/ci_analyzer_earthly:cache \
+docker-push \
--TAGS "${TAGS}"