diff --git a/.github/workflows/dockerhub-ci.yml b/.github/workflows/dockerhub-ci.yml index f032aa9a7..e441367fc 100755 --- a/.github/workflows/dockerhub-ci.yml +++ b/.github/workflows/dockerhub-ci.yml @@ -5,6 +5,11 @@ on: branches: [ dev ] workflow_dispatch: null +# Add permissions for the built-in GITHUB_TOKEN +permissions: + contents: read + packages: write + # Ensures only the latest workflow run for the same branch is active, canceling any in-progress runs. concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -23,11 +28,23 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Get release version run: echo "COMPAS_VERSION=$(sed -n '/const std::string VERSION_STRING/,/^$/p' ./src/changelog.h | sed 's/.*"\(.*\)"[^"]*$/\1/')" >> $GITHUB_ENV - - name: Print version - run: echo $COMPAS_VERSION + - name: Set lowercase repository name + run: echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV + + - name: Print version and repo + run: | + echo "Version: $COMPAS_VERSION" + echo "Lowercase repo: $REPO_LC" - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -40,6 +57,7 @@ jobs: tags: | teamcompas/compas:${{ env.COMPAS_VERSION }} teamcompas/compas:latest + ghcr.io/${{ env.REPO_LC }}:${{ env.COMPAS_VERSION }} + ghcr.io/${{ env.REPO_LC }}:latest cache-from: type=gha - cache-to: type=gha,mode=max - + cache-to: type=gha,mode=max \ No newline at end of file