You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Configures this workflow to run every time a change is pushed to the branch called `release`.
5
+
on:
6
+
workflow_dispatch:
7
+
inputs:
8
+
tag:
9
+
description: 'Tag to build'
10
+
required: true
11
+
default: 'latest'
12
+
type: string
13
+
14
+
15
+
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
16
+
env:
17
+
REGISTRY: ghcr.io
18
+
IMAGE_NAME: ${{ github.repository }}
19
+
20
+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
21
+
jobs:
22
+
build-and-push-image:
23
+
runs-on: ubuntu-latest
24
+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
25
+
permissions:
26
+
contents: read
27
+
packages: write
28
+
attestations: write
29
+
id-token: write
30
+
#
31
+
steps:
32
+
- name: Checkout repository
33
+
uses: actions/checkout@v4
34
+
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
35
+
- name: Log in to the Container registry
36
+
uses: docker/login-action@v3
37
+
with:
38
+
registry: ${{ env.REGISTRY }}
39
+
username: ${{ github.actor }}
40
+
password: ${{ secrets.GITHUB_TOKEN }}
41
+
- name: Set up QEMU
42
+
uses: docker/setup-qemu-action@v3
43
+
- name: Set up Docker Buildx
44
+
uses: docker/setup-buildx-action@v3
45
+
- name: Extract metadata (tags, labels) for Docker
46
+
id: meta
47
+
uses: docker/metadata-action@v5
48
+
with:
49
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
50
+
tags: |
51
+
type=raw, value=${{ inputs.tag }}
52
+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
53
+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
54
+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
0 commit comments