-
Notifications
You must be signed in to change notification settings - Fork 2
63 lines (55 loc) · 1.75 KB
/
build-image-periodically-1-branches.yaml
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
name: Build image and push
on:
# NOTE: Runs on branch or tag creation.
create:
branches:
- main
schedule:
# Run every Sunday at 1am o'clock.
- cron: '0 1 * * 0'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
architecture:
default: all
description: Architecture name to build for.
type: choice
options:
- all
- arm-64
- x86-64
build-args:
description: List of build-time variables.
use-cache:
description: Use cache when building the image.
default: true
type: boolean
tags:
description: Image tags to use for registering.
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.event.repository.name }}
jobs:
build-image-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: thaibault/build-image-push-action@main
with:
name: ${{ env.IMAGE_NAME }}
tags: ${{ inputs.tags || 'CURRENT_TAG_OR_BRANCH latest' }}
architecture: ${{ inputs.architecture || 'all' }}
build-args: |
BRANCH_NAME=${{ github.ref_name || 'main' }}
${{ inputs.build-args }}
cache-key: ${{ runner.os }}-buildx-layer-${{ github.sha }}
cache-restore-keys: ${{ runner.os }}-buildx-layer-
use-cache: ${{ inputs.use-cache && github.event_name != 'schedule' }}
alternate-registry: docker.io
alternate-username: ${{ secrets.DOCKERHUB_USERNAME }}
alternate-password: ${{ secrets.DOCKERHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}