This commit is contained in:
Marco Realacci 2024-05-14 01:07:31 +02:00
parent 5210b3d2e2
commit 1d070ad39f
2 changed files with 6 additions and 6 deletions

View file

@ -3,7 +3,7 @@ name: Create and publish a Docker image
# Configures this workflow to run every time a change is pushed to the branch called `release`. # Configures this workflow to run every time a change is pushed to the branch called `release`.
on: on:
push: push:
branches: ['main', 'dev'] branches: ['dev']
# 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. # 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.
env: env:
@ -43,11 +43,11 @@ jobs:
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. # It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image - name: Build and push Docker image
id: push id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 uses: docker/build-push-action@v5
with: with:
context: . context: .
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ghcr.io/notherealmarco/slaacsense:dev
# 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)." # 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)."
- name: Generate artifact attestation - name: Generate artifact attestation

View file

@ -8,12 +8,13 @@ name: Demo Push
on: on:
push: push:
branches: branches:
- dev - disabled
# tags: # tags:
# - v* # - v*
# pull_request: # pull_request:
# This creates an environment variable called `IMAGE_NAME ` with the value `ghtoken_product_demo`. # This creates an environment variable called `IMAGE_NAME ` with the value `ghtoken_product_demo`.
env: env:
REGISTRY: ghcr.io
IMAGE_NAME: slaacsense IMAGE_NAME: slaacsense
# #
jobs: jobs:
@ -35,11 +36,10 @@ jobs:
- name: Log in to registry - name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
#
- name: Push image - name: Push image
run: | run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
# This changes all uppercase characters to lowercase. # This changes all uppercase characters to lowercase.
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# This strips the git ref prefix from the version. # This strips the git ref prefix from the version.