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
Copy file name to clipboardExpand all lines: .github/workflows/release.yml
+52-31Lines changed: 52 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,36 @@
1
-
name: Release
2
-
# Controls when the workflow will run
1
+
name: Create and publish a Docker image
2
+
3
+
# Configures this workflow to run every time a change is pushed to the branch called `release`.
3
4
on:
4
-
release:
5
-
types:
6
-
- published
5
+
pull_request:
6
+
branches: main
7
+
push:
8
+
branches: main
9
+
tags: v.*
10
+
11
+
# 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.
12
+
env:
13
+
REGISTRY: ghcr.io
7
14
15
+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
8
16
jobs:
9
-
buildpush:
17
+
build-and-push-image:
10
18
runs-on: ubuntu-latest
19
+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
# 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.
46
+
- name: Log in to the Container registry
47
+
uses: docker/login-action@v3
31
48
with:
32
-
# Maybe there is a default env var for this?
33
-
registry: git.maronato.dev
34
-
username: ${{ github.repository_owner }}}
35
-
# Ideally, we should only need to set "permissions: package: write", but
36
-
# Gitea is having issues with that. For now, this is a manually created
37
-
# token available user-wise, with the "package:write" permission.
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
53
+
- name: Extract metadata (tags, labels) for Docker
43
54
id: meta
44
-
uses: docker/metadata-action@v4
55
+
uses: docker/metadata-action@v5
45
56
with:
46
-
# The container image name needs the custom registry in it.
# 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.
76
+
# 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.
77
+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
0 commit comments