opf/openproject

View on GitHub
.github/workflows/pullpreview.yml

Summary

Maintainability
Test Coverage
name: pullpreview

concurrency: ${{ github.ref }}

on:
  schedule:
    # this is used to make sure no dangling resources are left
    - cron: "30 2 * * *"
  pull_request:
    types: [labeled, unlabeled, synchronize, closed, reopened]

permissions:
  contents: read # to fetch code (actions/checkout)

jobs:
  deploy:
    permissions:
      contents: read # to fetch code (actions/checkout)
      deployments: write # to delete deployments
      pull-requests: write # to remove labels
      statuses: write # to create commit status

    if: github.repository == 'opf/openproject' && ( github.event_name == 'schedule' || github.event.label.name == 'pullpreview' || contains(github.event.pull_request.labels.*.name, 'pullpreview') )
    runs-on: ubuntu-latest
    timeout-minutes: 60
    steps:
    - uses: actions/checkout@v3
    - name: Generate .env.pullpreview file
      run: |
        echo "OPENPROJECT_SEED_ADMIN_USER_PASSWORD_RESET=false" >> .env.pullpreview
        echo "OPENPROJECT_SHOW__SETTING__MISMATCH__WARNING=false" >> .env.pullpreview
        echo "OPENPROJECT_FEATURE__STORAGES__MODULE__ACTIVE=true" >> .env.pullpreview
        echo "OPENPROJECT_FEATURE__SHOW__CHANGES__ACTIVE=true" >> .env.pullpreview
        echo "OPENPROJECT_LOOKBOOK__ENABLED=true" >> .env.pullpreview
        echo "OPENPROJECT_HSTS=false" >> .env.pullpreview
    - name: Boot as BIM edition
      if: contains(github.ref, 'bim/') || contains(github.head_ref, 'bim/')
      run: |
        echo "OPENPROJECT_EDITION=bim" >> .env.pullpreview
    - name: Prepare docker-compose files
      run: |
        cp ./docker/pullpreview/docker-compose.yml ./docker-compose.pullpreview.yml
        cp ./docker/prod/Dockerfile ./Dockerfile
    - uses: pullpreview/action@v5
      with:
        admins: crohr,HDinger,machisuji,oliverguenther,ulferts,wielinde,cbliard
        compose_files: docker-compose.pullpreview.yml
        instance_type: xlarge
        ports: 80,443,8080
        default_port: 443
        ttl: 10d
      env:
        AWS_ACCESS_KEY_ID: "${{ secrets.AWS_ACCESS_KEY_ID }}"
        AWS_SECRET_ACCESS_KEY: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
        AWS_REGION: eu-central-1