-
-
Notifications
You must be signed in to change notification settings - Fork 1k
77 lines (65 loc) · 2.27 KB
/
docker-publish-main.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
name: ASF-docker-publish-main
on:
push:
branches:
- main
env:
PLATFORMS: linux/amd64,linux/arm,linux/arm64
TAG: main
permissions:
packages: write
jobs:
main:
environment: release-docker
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/[email protected]
with:
show-progress: false
submodules: recursive
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to ghcr.io
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Prepare environment outputs
shell: sh
run: |
set -eu
echo "DATE_ISO8601=$(date --iso-8601=seconds --utc)" >> "$GITHUB_ENV"
echo "GHCR_REPOSITORY=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
echo "DH_REPOSITORY=$(echo ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
- name: Build and publish Docker image from Dockerfile
uses: docker/[email protected]
with:
context: .
platforms: ${{ env.PLATFORMS }}
provenance: true
sbom: true
secrets: |
ASF_PRIVATE_SNK=${{ secrets.ASF_PRIVATE_SNK }}
STEAM_TOKEN_DUMPER_TOKEN=${{ secrets.STEAM_TOKEN_DUMPER_TOKEN }}
labels: |
org.opencontainers.image.created=${{ env.DATE_ISO8601 }}
org.opencontainers.image.version=${{ github.sha }}
org.opencontainers.image.revision=${{ github.sha }}
tags: |
ghcr.io/${{ env.GHCR_REPOSITORY }}:${{ env.TAG }}
${{ env.DH_REPOSITORY }}:${{ env.TAG }}
push: true
- name: Update DockerHub repository description
uses: peter-evans/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.DH_REPOSITORY }}
short-description: ${{ github.event.repository.description }}