Skip to content

Commit

Permalink
Update CI workflow to work for Dependabot PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnvanderhorst authored Nov 26, 2024
1 parent 09b3365 commit 68121cc
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ env:
DB_PASSWORD: mysql

jobs:
laravel-tests:
tests:
runs-on: ubuntu-latest
environment: Build
steps:
Expand All @@ -35,12 +35,6 @@ jobs:
restore-keys: |
${{ runner.os }}-node-
- name: Docker Login
uses: docker/login-action@v3
with:
username: esacci
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand Down Expand Up @@ -85,22 +79,34 @@ jobs:
- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/phpunit -c phpunit.xml --coverage-clover=coverage.xml

- name: Upload to codecov
uses: codecov/codecov-action@v3
publish:
runs-on: ubuntu-latest
needs: tests
if: github.secret_source == 'Actions' || github.secret_source == 'Dependabot'
steps:
- name: Docker Login
uses: docker/login-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
fail_ci_if_error: true
username: esacci
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Build and push Docker images
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
tags: esac/website:${{ github.run_number }}

- name: Upload to codecov
uses: codecov/codecov-action@v3
if: secrets.CODECOV_TOKEN
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: coverage.xml
fail_ci_if_error: true

deploy:
runs-on: ubuntu-latest
needs: laravel-tests
needs: publish
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Deploy via SSH
Expand All @@ -109,4 +115,4 @@ jobs:
host: ${{ secrets.SSH_HOST }}
user: ic
private_key: ${{ secrets.SSH_PRIVATE_KEY }}
command: ./update.sh website "${{ github.run_number }}" "${{ github.actor }}" "${{ github.event.head_commit.message }}" "${{ github.event.head_commit.timestamp }}" "${{ github.ref }}"
command: ./update.sh website "${{ github.run_number }}" "${{ github.actor }}" "${{ github.event.head_commit.message }}" "${{ github.event.head_commit.timestamp }}" "${{ github.ref }}"

0 comments on commit 68121cc

Please sign in to comment.