diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..88189387 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,40 @@ +name: Deploy to Pages + +on: + push: + branches: [ "master" ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Build docker image + run: docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) web + - name: Install composer dependencies + run: docker-compose run --rm -T web composer install --no-interaction --no-progress + - name: Tests + run: docker-compose run --rm -T web ./vendor/bin/phpunit tests/ + - name: Install node dependencies + run: docker-compose run --rm -T web yarn install + - name: Build + run: docker-compose run --rm -T web yarn production + - name: Deploy + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: './build_production/' + branch: gh-pages + clean-exclude: pr-preview diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..f55582cc --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,40 @@ +name: Tests and Preview + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed + +concurrency: + group: preview-${{ github.ref }} + cancel-in-progress: true + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Build docker image + run: docker-compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) web + + - name: Install composer dependencies + run: docker-compose run --rm -T web composer install --no-interaction --no-progress + + - name: Tests + run: docker-compose run --rm -T web ./vendor/bin/phpunit tests/ + + - name: Install node dependencies + run: docker-compose run --rm -T web yarn install + + - name: Build + run: docker-compose run --rm -T web yarn production + + - name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ./build_production/