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: Upload Docker image to Docker Hub | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| release: | |
| name: Upload Docker image to Docker Hub | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set appVersion | |
| uses: bhowell2/github-substring-action@v1 | |
| id: appVersion | |
| with: | |
| value: ${{github.ref}} | |
| index_of_str: "refs/tags/v" | |
| - run: echo "Version = ${{steps.appVersion.outputs.substring}}" | |
| - name: Set up JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 17 | |
| cache: gradle | |
| - name: Package app | |
| run: | | |
| ./gradlew shadowJar --no-daemon | |
| mv build/libs/pharmcat-${{steps.appVersion.outputs.substring}}-all.jar build/pharmcat.jar | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| id: docker_build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: pgkb/pharmcat:latest,pgkb/pharmcat:${{steps.appVersion.outputs.substring}} | |
| env: | |
| # Explicitly enable BuildKit (optional with Buildx) | |
| DOCKER_BUILDKIT: 1 | |
| # Limit to one parallel build for lower RAM | |
| BUILDKIT_MAX_PARALLELISM: 1 | |
| - name: Send Slack notification on failure | |
| if: failure() | |
| uses: slackapi/slack-github-action@v1 | |
| with: | |
| channel-id: 'dev' | |
| payload: | | |
| { | |
| "attachments": [{ | |
| "color": "#ff0000", | |
| "blocks": [ | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": ":stop: <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|FAILED ${{ github.workflow }}!>" | |
| } | |
| }, | |
| { | |
| "type": "section", | |
| "text": { | |
| "type": "mrkdwn", | |
| "text": "Triggered by ${{ github.event_name }} on <${{ github.event.pull_request.html_url || github.event.head_commit.url }}|${{ github.ref_name }}> by ${{ github.actor }}." | |
| } | |
| }, | |
| { | |
| "type": "context", | |
| "elements": [ | |
| { | |
| "type": "mrkdwn", | |
| "text": "Last commit:\n${{ github.event.head_commit.message }}" | |
| } | |
| ] | |
| } | |
| ] | |
| }] | |
| } | |
| env: | |
| SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }} |