Workflow file for this run
This file contains hidden or 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: Build and Deploy to AWS | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - azure-migration | |
| env: | |
| JAR_FILENAME: Lobby-Platform | |
| ARTIFACT_NAME: backend-app | |
| SYSTEMD_SERVICE_NAME: lobby-platform | |
| permissions: | |
| id-token: write # This is required for requesting the JWT | |
| contents: read # This is required for actions/checkout | |
| packages: write # This is required for publishing the package | |
| jobs: | |
| build: | |
| name: Build on GitHub | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the repo | |
| - name: git checkout | |
| uses: actions/checkout@v3 | |
| # Setup JDK 17 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'corretto' | |
| # Maven Verify | |
| - name: Maven Verify | |
| run: ./mvnw -B verify -DJAR_FILENAME=${{ env.JAR_FILENAME }} | |
| # Docker Build | |
| - name: Docker Build | |
| shell: bash | |
| run: docker build \ | |
| -t ghcr.io/${{ github.repository }}/api:${{ github.sha }} \ | |
| -f docker/Dockerfile \ | |
| . | |
| # Login to GitHub Container Registry | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Docker Push | |
| - name: Docker Push | |
| run: docker push ghcr.io/${{ github.repository }}/api:${{ github.sha }} | |
| # Dump GitHub Context | |
| - name: Dump GitHub Context | |
| env: | |
| GITHUB_CONTEXT: ${{ toJSON(github) }} | |
| run: | | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| echo "$GITHUB_CONTEXT" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY |