Skip to content

Optimise pipeline for release and daily operation (#222) #1

Optimise pipeline for release and daily operation (#222)

Optimise pipeline for release and daily operation (#222) #1

Workflow file for this run

name: Release Artifacts and Container Images
on:
push:
tags:
- "v*"
branches: [main]
permissions:
contents: write
packages: write
jobs:
publish-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Call Dagger Function
uses: dagger/dagger-for-github@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: "latest"
verb: call
args: release --github-token='env:${{ env.GITHUB_TOKEN }}'
publish-images:
runs-on: ubuntu-latest
environment: PROD
env:
COSIGN_PASSWORD: ${{ secrets.COSIGN_PASSWORD }}
COSIGN_KEY: ${{ secrets.COSIGN_KEY }}
REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
REGISTRY_ADDRESS: ${{ vars.REGISTRY_ADDRESS }}
PUBLISH_ADDRESS: ${{ vars.PUBLISH_ADDRESS }}
TAG: ${{ github.ref_name }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Call Docker-Publish Function
uses: dagger/dagger-for-github@v6
with:
version: "latest"
verb: call
args: "publish-image --cosign-password='env:${{ env.COSIGN_PASSWORD }}' --cosign-key='env:${{ env.COSIGN_KEY }}' --reg-username='${{ env.REGISTRY_USERNAME }}' --reg-password='env:${{ env.REGISTRY_PASSWORD }}' --reg-address='${{ env.REGISTRY_ADDRESS }}' --publish-address='${{ env.PUBLISH_ADDRESS }}' --tag='${{ env.TAG }}'"
- name: Notify on success
if: success()
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
body: "Container image published successfully! 🎉"
})
- name: Notify on failure
if: failure()
uses: actions/github-script@v6
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
body: "Failed to publish Container image. ❌"
})