Skip to content

use github sha as version for image deploy #151

use github sha as version for image deploy

use github sha as version for image deploy #151

Workflow file for this run

name: "CI Pipeline"
on:
push:
branches: [main]
paths-ignore:
- "**/*.md"
pull_request:
# TODO: restrict later
# branches: [main]
# Allow to run this workflow manually
workflow_dispatch:
env:
RUN_ID: ${{ github.run_id }}
CONTAINER_REGISTRY: ghcr.io
CONTAINER_IMAGE_NAME: ${{ github.repository }}
CONTAINER_IMAGE_VERSION: ${{ github.event.pull_request.head.sha || github.sha }}
jobs:
##############################################
# jobs dispatched to separate workflow files #
##############################################
security-jobs:
uses: ./.github/workflows/security-jobs.yml
secrets: inherit # so the backend workflow can access "secrets.SLACK_WEBHOOK_URL" and others
permissions:
contents: read
security-events: write # trivy scan needs this
frontend-checks:
uses: ./.github/workflows/frontend-checks.yml
secrets: inherit
frontend-build-image-and-scan:
if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'dev-env') || contains(github.event.labeled.labels.*.name, 'dev-env') }}
uses: ./.github/workflows/frontend-build-image-and-scan.yml
secrets: inherit
permissions:
contents: read
security-events: write
with:
run-id: ${{ github.run_id }}
container-registry: ghcr.io
container-image-name: ${{ github.repository }}
container-image-version: ${{ github.event.pull_request.head.sha || github.sha }}
frontend-push-image-to-registry:
if: ${{ github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'dev-env') || contains(github.event.labeled.labels.*.name, 'dev-env') }}
uses: ./.github/workflows/frontend-push-image-to-registry.yml
secrets: inherit
permissions:
contents: read
id-token: write # This is used to complete the identity challenge with sigstore/fulcio..
packages: write
needs:
- security-jobs
- frontend-checks
- frontend-build-image-and-scan
with:
run-id: ${{ github.run_id }}
container-registry: ghcr.io
container-image-name: ${{ github.repository }}
container-image-version: ${{ github.event.pull_request.head.sha || github.sha }}
# ######################
# # Deploy new versions to staging
# ######################
frontend-deploy-staging:
if: ${{ github.ref == 'refs/heads/main' }}
uses: ./.github/workflows/frontend-deploy-staging.yml
needs:
- security-jobs
- frontend-checks
- frontend-build-image-and-scan
- frontend-push-image-to-registry
permissions:
id-token: write
secrets: inherit
with:
container-image-version: ${{ github.event.pull_request.head.sha || github.sha }}