Merge pull request #192 from sopra-fs24-group-09/develop #71
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: Deploy Project to App Engine | |
on: | |
push: | |
branches: | |
- main | |
# run the workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
name: Test and Sonarqube | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository code | |
uses: actions/checkout@v4 | |
- name: Install Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Test and analyze | |
run: ./gradlew test jacocoTestReport sonar | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
deploy: | |
name: Deploying to Google Cloud | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Prepare app.yaml MONGODB_PASSWORD | |
run: sed -i "s/MONGO_PLACEHOLDER/${{ secrets.MONGODB_PASSWORD }}/g" app.yaml | |
- name: Prepare app.yaml API_KEY | |
run: sed -i "s/API_PLACEHOLDER/${{ secrets.API_KEY }}/g" app.yaml | |
- name: Deploy to App Engine | |
id: deploy | |
uses: google-github-actions/[email protected] | |
with: | |
deliverables: app.yaml | |
version: v2 | |
credentials: ${{ secrets.GCP_SERVICE_CREDENTIALS }} | |
- name: Test | |
run: curl "${{ steps.deploy.outputs.url }}" |