-
Notifications
You must be signed in to change notification settings - Fork 33
41 lines (37 loc) · 1.47 KB
/
publish-ghcr.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
#
name: Create and publish a Docker image
on:
workflow_dispatch:
release:
types: [published]
# Defines environment variables for the workflow. These are used for the Container registry domain, and a version for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
VERSION: ${{ github.ref_name }}
jobs:
build-and-push-image-gpu:
runs-on: ubuntu-latest
# Sets the permissions granted to the `GH_PAT` for the actions in this job.
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# 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.
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GH_PAT }}
- name: lowercase github.repository
run: |
echo "IMAGE_NAME=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile-gpu
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest, ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}