Skip to content

Commit 806c263

Browse files
authored
add: github image deployment (#1418)
* add: GHCR push * add Github container repo to docker CI * add lowercase for GHCR
1 parent f0ab925 commit 806c263

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

.github/workflows/dockerhub-ci.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
branches: [ dev ]
66
workflow_dispatch: null
77

8+
# Add permissions for the built-in GITHUB_TOKEN
9+
permissions:
10+
contents: read
11+
packages: write
12+
813
# Ensures only the latest workflow run for the same branch is active, canceling any in-progress runs.
914
concurrency:
1015
group: ${{ github.workflow }}-${{ github.ref }}
@@ -23,11 +28,23 @@ jobs:
2328
username: ${{ secrets.DOCKER_USERNAME }}
2429
password: ${{ secrets.DOCKER_PASSWORD }}
2530

31+
- name: Log in to GitHub Container Registry
32+
uses: docker/login-action@v3
33+
with:
34+
registry: ghcr.io
35+
username: ${{ github.actor }}
36+
password: ${{ secrets.GITHUB_TOKEN }}
37+
2638
- name: Get release version
2739
run: echo "COMPAS_VERSION=$(sed -n '/const std::string VERSION_STRING/,/^$/p' ./src/changelog.h | sed 's/.*"\(.*\)"[^"]*$/\1/')" >> $GITHUB_ENV
2840

29-
- name: Print version
30-
run: echo $COMPAS_VERSION
41+
- name: Set lowercase repository name
42+
run: echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
43+
44+
- name: Print version and repo
45+
run: |
46+
echo "Version: $COMPAS_VERSION"
47+
echo "Lowercase repo: $REPO_LC"
3148
3249
- name: Set up Docker Buildx
3350
uses: docker/setup-buildx-action@v3
@@ -40,6 +57,7 @@ jobs:
4057
tags: |
4158
teamcompas/compas:${{ env.COMPAS_VERSION }}
4259
teamcompas/compas:latest
60+
ghcr.io/${{ env.REPO_LC }}:${{ env.COMPAS_VERSION }}
61+
ghcr.io/${{ env.REPO_LC }}:latest
4362
cache-from: type=gha
44-
cache-to: type=gha,mode=max
45-
63+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)