add backbutton label #767
Workflow file for this run
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: CI | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
# Allow to run this workflow manually | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
CONTAINER_IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
test-build-strapi: | |
permissions: | |
packages: read | |
runs-on: ubuntu-latest | |
timeout-minutes: 25 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
cache: "npm" | |
- name: Install dependencies | |
run: npm ci --include=dev | |
- name: Run build | |
run: npm run build | |
- name: Run test | |
run: cp .env.example .env && npm run test | |
env: | |
NODE_ENV: test | |
build-push-image: | |
needs: [test-build-strapi] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
permissions: | |
security-events: write | |
packages: write | |
id-token: write | |
outputs: | |
version: ${{ github.sha }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Build an image from Dockerfile | |
run: | | |
docker build -t ${{ env.IMAGE_NAME }}:${{ github.sha }} . --build-arg COMMIT_SHA=${{ github.sha }} | |
- name: Install cosign | |
uses: sigstore/cosign-installer@4959ce089c160fddf62f7b42464195ba1a56d382 | |
- name: Login to container registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate cosign vulnerability scan record | |
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 | |
with: | |
image-ref: ${{ env.IMAGE_NAME }}:${{ github.sha }} | |
format: "cosign-vuln" | |
output: "vulnerabilities.json" | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@6e7b7d1fd3e4fef0c5fa8cce1229c54b2c9bd0d8 | |
with: | |
image-ref: "${{ env.IMAGE_NAME }}:${{ github.sha }}" | |
format: "template" | |
template: "@/contrib/sarif.tpl" | |
output: "trivy-results.sarif" | |
ignore-unfixed: true | |
vuln-type: "os,library" | |
severity: "CRITICAL,HIGH" | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@81b419c908d540ec4c7da9bfb4b5d941fca8f624 | |
with: | |
sarif_file: "trivy-results.sarif" | |
- name: Push image | |
run: | | |
docker tag ${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
docker tag ${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | |
docker push --all-tags ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Sign the published Docker image | |
run: cosign sign --yes ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | |
- name: Attest the vulnerability scan | |
run: cosign attest --yes --replace --predicate vulnerabilities.json --type vuln ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} | |
deploy-staging: | |
needs: [build-push-image] | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
environment: staging | |
steps: | |
- name: Deploy new staging image | |
uses: digitalservicebund/argocd-deploy@4fac1bb67c92ed168f6d9b22f8779ce241a9e412 # v1.0.0 | |
with: | |
environment: staging | |
version: ${{ github.sha }} | |
deploying_repo: a2j-rechtsantragstelle-strapi | |
infra_repo: a2j-rechtsantragstelle-strapi-infra | |
deploy_key: ${{ secrets.DEPLOY_KEY }} | |
app: a2j-rast-strapi | |
argocd_pipeline_password: ${{ secrets.ARGOCD_PIPELINE_PASSWORD }} | |
argocd_server: ${{ secrets.ARGOCD_SERVER }} | |
argocd_sync_timeout: 300 | |
- name: Report Deployment | |
uses: digitalservicebund/track-deployment@5a2815e150e1268983aac5ca04c8c046ed1b614a # v1.0.0 | |
with: | |
project: a2j-rechtsantragstelle | |
environment: staging | |
metrics_deployment_webhook_url: ${{ secrets.METRICS_DEPLOYMENT_WEBHOOK_URL }} | |
metrics_webhook_token: ${{ secrets.METRICS_WEBHOOK_TOKEN }} |