codeql workflow: build when autobuild failed #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Build demoapp-backend | |
# Events: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows | |
on: | |
# Run workflow on push except for ignored branches and paths | |
push: | |
# Secrets aren't available for dependabot on push. https://docs.github.com/en/enterprise-cloud@latest/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/troubleshooting-the-codeql-workflow#error-403-resource-not-accessible-by-integration-when-using-dependabot | |
branches-ignore: | |
- 'dependabot/**' | |
- 'cherry-pick-*' | |
paths-ignore: | |
- '**.md' # Ignore documentation changes | |
- '.github/dependabot.yml' # Ignore dependabot changes | |
# Allow user to manually trigger Workflow execution | |
workflow_dispatch: | |
jobs: | |
lint: | |
uses: ./.github/workflows/lint.yml # Workflow calls need to be executed as jobs | |
with: | |
yaml: true | |
sonarqube-scan: | |
runs-on: ubuntu-latest | |
steps: | |
- name: SonarQube Scan | |
uses: sonarsource/sonarqube-scan-action@master | |
with: | |
# github context: https://docs.github.com/en/actions/learn-github-actions/contexts#github-context | |
args: > | |
-Dsonar.organization=${{ github.repository_owner }} | |
-Dsonar.projectKey=demoapp-backend | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
SONAR_HOST_URL: https://sonarcloud.io/ | |
build: | |
needs: sonarqube-scan | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone | |
uses: actions/checkout@v4 # https://github.com/marketplace/actions/checkout | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 # https://github.com/marketplace/actions/docker-setup-qemu | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 # https://github.com/marketplace/actions/docker-setup-buildx | |
- name: Build container image | |
uses: docker/build-push-action@v5 # https://github.com/marketplace/actions/build-and-push-docker-images | |
with: | |
context: . | |
file: Containerfile | |
push: false | |
tags: demoapp-backend | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |