-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (62 loc) · 2.01 KB
/
Copy pathdocker.yaml
File metadata and controls
71 lines (62 loc) · 2.01 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
name: Docker
on:
workflow_dispatch:
inputs:
release_tag:
required: true
description: The release tag to build
workflow_call:
inputs:
release_tag:
type: string
required: true
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v5
with:
fetch-tags: true
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to github container registry
env:
REGISTRY: ghcr.io
USERNAME: ${{ github.actor }}
PASSWORD: ${{ secrets.GITHUB_TOKEN }}
run: |
for attempt in 1 2 3; do
if printf '%s' "$PASSWORD" | docker login "$REGISTRY" --username "$USERNAME" --password-stdin; then
exit 0
fi
if [ "$attempt" -eq 3 ]; then
exit 1
fi
sleep "$((attempt * 5))"
done
- name: Set docker_tag
env:
RELEASE_TAG: ${{ inputs.release_tag }}
run: |
git check-ref-format --allow-onelevel "refs/tags/$RELEASE_TAG"
docker_tag="${RELEASE_TAG#v}"
printf 'DOCKER_TAG=%s\n' "$docker_tag" >> "$GITHUB_ENV"
printf 'Going to build: %s\n' "$docker_tag"
- name: Build and push
uses: docker/build-push-action@v7
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: coolapso/convcommitlint:latest,coolapso/convcommitlint:${{ env.DOCKER_TAG }},ghcr.io/coolapso/convcommitlint:latest,ghcr.io/coolapso/convcommitlint:${{ env.DOCKER_TAG }}
build-args: VERSION=${{ inputs.release_tag }}