-
Notifications
You must be signed in to change notification settings - Fork 4
44 lines (38 loc) · 1.32 KB
/
build.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
name: build-push
on:
workflow_dispatch:
push:
branches:
- '*'
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: test
run: make docker-test
- name: build
run: make docker-image
- name: Log in to GHCR
run: |
echo "${{ github.token }}" | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: publish-latest
run: |
docker tag ${{ github.repository }}:latest ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:latest
if: github.ref == 'refs/heads/master'
- name: publish-branch
run: |
docker tag ${{ github.repository }}:latest ghcr.io/${{ github.repository }}:${GITHUB_REF##*/}
docker push ghcr.io/${{ github.repository }}:${GITHUB_REF##*/}
if: startsWith(github.ref, 'refs/heads/') && github.ref != 'refs/heads/master'
- name: publish-tag
run: |
docker tag ${{ github.repository }}:latest ghcr.io/${{ github.repository }}:${GITHUB_REF##*/}
docker push ghcr.io/${{ github.repository }}:${GITHUB_REF##*/}
if: startsWith(github.ref, 'refs/tags/v')