Skip to content

Merge pull request #148 from dduportal/updatecli_main_262a8e1ebf49a5e… #190

Merge pull request #148 from dduportal/updatecli_main_262a8e1ebf49a5e…

Merge pull request #148 from dduportal/updatecli_main_262a8e1ebf49a5e… #190

Workflow file for this run

name: Build, Test and Release the Docker Image
on:
# On each branch/commit
push:
paths:
- 'docker-image/**'
- '.github/workflows/docker-image.yaml'
# On each pull request
pull_request:
# Manually
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
# Allow push to GHCR registry
# https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-ghcrio
permissions:
packages: write
contents: read
env:
IMAGE_NAME: "ghcr.io/${{ github.repository_owner }}/jenkins-example:${{ github.sha }}"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: 'docker build --tag ${IMAGE_NAME} --label "gha_run_number=${GITHUB_RUN_ID}" ./docker-image/'
- name: Push image
run: 'docker push $IMAGE_NAME'
if: github.event_name != 'pull_request'