Skip to content

Update docker-image.yml #4

Update docker-image.yml

Update docker-image.yml #4

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
GITHUB_WORKFLOW: dati-semantic-wordpress
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build the Docker image
run: |
IMAGE="$REGISTRY/$IMAGE_NAME"
TAG="$(date +'%Y%m%d')-${{github.run_number}}-$(git rev-parse --short HEAD)"
docker build . --file Dockerfile --tag ${IMAGE}:${TAG}
publish:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
permissions:
contents: read
packages: write
needs:
- build
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the GitHub Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
run: |
IMAGE="$REGISTRY/$IMAGE_NAME"
TAG="$(date +'%Y%m%d')-${{github.run_number}}-$(git rev-parse --short HEAD)"
docker build . --file Dockerfile --tag ${IMAGE}:${TAG}
docker push ${IMAGE}:${TAG}
docker tag ${IMAGE}:${TAG} ${IMAGE}:latest
docker push ${IMAGE}:latest
- name: Output image name
id: extractImage
run: echo "imageName=${IMAGE}:${TAG}" >> $GITHUB_ENV
deploy:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
permissions:
contents: read
packages: write
needs:
- publish
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Deploy using extracted image
run: |
echo "Deploying image: ${{ env.imageName }}"
- uses: convictional/[email protected]
with:
owner: teamdigitale
repo: dati-semantic-kubernetes
github_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
workflow_file_name: update-config.yaml
ref: dev
wait_interval: 20
inputs: '{"serviceName": "dati-semantic-wordpress", "imageWithNewTag": "${{ env.imageName }}"}'