Skip to content

Commit

Permalink
Fix github actions to upload to GHCR (#652)
Browse files Browse the repository at this point in the history
* Update docker.yml

* Update docker.yml

* Update docker.yml

* Update docker.yml

* Update docker.yml

* Update docker.yml

* Update docker.yml

* Update docker.yml

* Update containerize-on-tag.yml

* Update docker.yml
  • Loading branch information
RadioAndrea authored Dec 12, 2023
1 parent e9c2c6b commit 8b9c010
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/containerize-on-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ env:
IMAGE_BASE: freetakteam/freetakserver
IMAGE_TAG: :${{ github.ref_name }}
OC_REGISTRY: ghcr.io
REGISTRY_URL: "ghcr.io/freetakteam/freetakserver"

jobs:
lint:
Expand Down Expand Up @@ -67,14 +68,16 @@ jobs:
- uses: actions/checkout@v4
- name: Build the container image
# can this be converted to podman at some point to be more foss?
run: docker build . --file Dockerfile --tag $OC_REGISTRY/$IMAGE_BASE:$IMAGE_TAG --tag $OC_REGISTRY/$IMAGE_BASE:latest --label "runnumber=${GITHUB_RUN_ID}"
run: |
SANITIZED_TAG="$(echo ${IMAGE_TAG//[^[:alnum:]]/_} | tr '[:upper:]' '[:lower:]' )"
docker build . --file Dockerfile --tag $REGISTRY_URL:$SANITIZED_TAG --tag $REGISTRY_URL:latest --label "runnumber=${GITHUB_RUN_ID}"
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $OC_REGISTRY -u $ --password-stdin

- name: Push image to registry
run: |
echo IMAGE_BASE=$IMAGE_BASE
docker push $OC_REGISTRY/$IMAGE_BASE:$IMAGE_TAG
SANITIZED_TAG="$(echo ${IMAGE_TAG//[^[:alnum:]]/_} | tr '[:upper:]' '[:lower:]' )"
docker push $OC_REGISTRY/$IMAGE_BASE:$SANITIZED_TAG
docker push $OC_REGISTRY/$IMAGE_BASE:latest
12 changes: 7 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
push:

env:
IMAGE_BASE: freetakteam/ui
IMAGE_TAG: ${{ github.ref_name }}
IMAGE_SHA: ${{ github.sha }}
OC_REGISTRY: ghcr.io
REGISTRY_URL: "ghcr.io/freetakteam/freetakserver"

jobs:
build_docker_image:
Expand All @@ -18,14 +18,16 @@ jobs:
- uses: actions/checkout@v4
- name: Build the container image
# can this be converted to podman at some point to be more foss?
run: docker build . --file Dockerfile --tag $OC_REGISTRY/$IMAGE_BASE:$IMAGE_TAG --tag $OC_REGISTRY/$IMAGE_BASE:$IMAGE_SHA --label "runnumber=${GITHUB_RUN_ID}"
run: |
SANITIZED_TAG="$(echo ${IMAGE_TAG//[^[:alnum:]]/_} | tr '[:upper:]' '[:lower:]' )"
docker build . --file Dockerfile --tag $REGISTRY_URL:$SANITIZED_TAG --tag $REGISTRY_URL:$IMAGE_SHA --label "runnumber=${GITHUB_RUN_ID}"
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login $OC_REGISTRY -u $ --password-stdin

- name: Push image to registry
run: |
echo IMAGE_BASE=$IMAGE_BASE
docker push $OC_REGISTRY/$IMAGE_BASE:$IMAGE_TAG
docker push $OC_REGISTRY/$IMAGE_BASE:$IMAGE_SHA
SANITIZED_TAG="$(echo ${IMAGE_TAG//[^[:alnum:]]/_} | tr '[:upper:]' '[:lower:]' )"
docker push $REGISTRY_URL:$SANITIZED_TAG
docker push $REGISTRY_URL:$IMAGE_SHA

0 comments on commit 8b9c010

Please sign in to comment.