Skip to content

Publish docker image as package #7

Publish docker image as package

Publish docker image as package #7

name: Publish docker image as package
# To manually run the workflow on GH, use the workflow_dispatch event trigger
# on: workflow_dispatch
# To test workflow using act, use the push event
# on:
# push:
# branches:
# - main
# To automatically run depending on the status of the build.yaml workflow, use workflow_run event trigger
on:
workflow_run:
workflows: [Setup and build packages]
types: [completed]
jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- run: echo 'The build workflows have passed'
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The build workflows have failed'
publish_package:
needs: on-success # Uncomment when on default branch (main)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to GH container registry
run: |
docker login --username ${{ github.actor }} --password ${{ secrets.GH_PAT }} ghcr.io
- name: Cleanup system
run: |
docker image prune
- name: Build Docker image
run: |
docker build --no-cache . -t ghcr.io/SaxionMechatronics/sarax-framework:latest
- name: Publish image
run: |
docker push ghcr.io/SaxionMechatronics/sarax-framework:latest