-
-
Notifications
You must be signed in to change notification settings - Fork 5
92 lines (80 loc) · 2.63 KB
/
docker-pub.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Docker Pub
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
tags:
- 'v*.*.*'
jobs:
build:
name: Buid and push Docker image to GitHub Container registry
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y%m%d')"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- 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.repository_owner }}
password: ${{ secrets.GH_TOKEN }}
- name: Build Nightly Meta
run: |
echo "DEVELOPMENT_TAG=ghcr.io/barelyhuman/goblin:nightly-${{ steps.date.outputs.date }}" >> $GITHUB_ENV
- name: Build Release Meta
run: |
echo "RELEASE_TAG=ghcr.io/barelyhuman/goblin:${{ github.ref_name }}" >> $GITHUB_ENV
if: github.ref_type == 'tag'
- name: Build and push nightly
uses: docker/build-push-action@v5
id: push
env:
REGISTRY: ghcr.io
OWNER: ${{ github.repository_owner }}
IMAGE_NAME: ${{ github.repository }}
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.DEVELOPMENT_TAG }},nightly
- name: Build and push release tag
if: github.ref_type == 'tag'
uses: docker/build-push-action@v5
id: pushRelease
env:
REGISTRY: ghcr.io
OWNER: ${{ github.repository_owner }}
IMAGE_NAME: ${{ github.repository }}
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.RELEASE_TAG }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/barelyhuman/goblin
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
- name: Generate release artifact attestation
if: github.ref_type == 'tag'
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/barelyhuman/goblin
subject-digest: ${{ steps.pushRelease.outputs.digest }}
push-to-registry: true