Skip to content

feat: add re-ordering mechanism to attributes and methods #210

feat: add re-ordering mechanism to attributes and methods

feat: add re-ordering mechanism to attributes and methods #210

Workflow file for this run

name: Build and Push Docker Image
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
packages: write
jobs:
detect-changes:
name: Detect changes
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
docker-relevant: ${{ steps.filter.outputs.docker-relevant }}
should-skip: ${{ steps.skip-check.outputs.should_skip }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- id: skip-check
uses: fkirc/skip-duplicate-actions@f75f66ce1886f00957d99748a42c724f4330bdcf # v5
with:
# Never skip push-to-main — always need fresh images after merge
do_not_skip: '["push", "workflow_dispatch"]'
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
id: filter
if: steps.skip-check.outputs.should_skip != 'true'
with:
filters: |
docker-relevant:
- 'library/**'
- 'standalone/**'
- 'docker/**'
- 'nginx.conf'
- 'package.json'
- 'package-lock.json'
- 'tsconfig*.json'
- '.github/workflows/build-and-push.yml'
build-and-push-workflow:
name: ${{ matrix.name }}
needs: [detect-changes]
if: >
github.actor != 'dependabot[bot]' &&
needs.detect-changes.outputs.should-skip != 'true' && (
needs.detect-changes.outputs.docker-relevant == 'true' ||
github.event_name == 'push'
)
strategy:
fail-fast: false
matrix:
include:
- name: Webapp
dockerfile: ./standalone/webapp/Dockerfile
image: ghcr.io/ls1intum/apollon/webapp
context: .
- name: Server
dockerfile: ./standalone/server/Dockerfile
image: ghcr.io/ls1intum/apollon/server
context: .
uses: ls1intum/.github/.github/workflows/build-and-push-docker-image.yml@main
with:
image-name: ${{ matrix.image }}
docker-file: ${{ matrix.dockerfile }}
docker-context: ${{ matrix.context }}
tags: "type=sha,format=long"
# Gate job for required checks — handles skipped builds correctly
docker-build-gate:
name: Docker Build Gate
runs-on: ubuntu-latest
needs: [detect-changes, build-and-push-workflow]
if: always()
steps:
- name: Evaluate results
run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
echo "Docker build failed"
exit 1
fi
if [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "Docker build was cancelled"
exit 1
fi
echo "Docker build passed or was skipped"
deploy-staging:
name: Deploy to Staging
needs: [docker-build-gate, build-and-push-workflow]
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.docker-build-gate.result == 'success' && needs.build-and-push-workflow.result == 'success'
uses: ./.github/workflows/deploy-staging.yml
with:
image-tag: sha-${{ github.sha }}
deploy-app: true
secrets: inherit