|
1 | 1 | name: Publish Docker Image |
2 | 2 |
|
3 | 3 | on: |
| 4 | + release: |
| 5 | + types: [created] |
4 | 6 | push: |
5 | 7 | branches: |
6 | 8 | - main |
|
17 | 19 |
|
18 | 20 | env: |
19 | 21 | DOCKER_REPO: datasqrl/flink-jar-runner |
| 22 | + VERSION: ${{ github.event_name == 'release' && github.event.action == 'created' && github.ref_name || 'snapshot' }} |
20 | 23 |
|
21 | 24 | steps: |
22 | 25 | - name: Checkout code |
|
26 | 29 | uses: docker/setup-buildx-action@v2 |
27 | 30 |
|
28 | 31 | - name: Log in to Docker Hub |
| 32 | + if: github.event_name == 'release' && github.event.action == 'created' |
29 | 33 | uses: docker/login-action@v2 |
30 | 34 | with: |
31 | 35 | username: ${{ secrets.DOCKER_USERNAME }} |
|
36 | 40 | docker pull gradle:8.6-jdk11 |
37 | 41 | docker pull flink:1.19.1-scala_2.12-java11 |
38 | 42 |
|
39 | | - - name: Build and push Docker image |
| 43 | + - name: Run Maven Build |
| 44 | + if: github.event_name == 'release' && github.event.action == 'created' |
| 45 | + run: | |
| 46 | + mvn versions:set -DnewVersion=${{ env.VERSION }} |
| 47 | + mvn clean install -DskipTests=true |
| 48 | +
|
| 49 | + - name: Build Docker image |
40 | 50 | working-directory: flink-dockerfile-example |
41 | 51 | run: | |
42 | | - DOCKER_TAG=$DOCKER_REPO:0.0.1-RC1-sqrl${{ matrix.SQRL_VERSION }} |
| 52 | + DOCKER_TAG=$DOCKER_REPO:${{ env.VERSION }}-sqrl${{ matrix.SQRL_VERSION }} |
43 | 53 | docker build --build-arg SQRL_VERSION=${{ matrix.SQRL_VERSION }} -t $DOCKER_TAG . |
| 54 | +
|
| 55 | + - name: Push Docker image |
| 56 | + if: github.event_name == 'release' && github.event.action == 'created' |
| 57 | + run: | |
44 | 58 | docker push $DOCKER_TAG |
| 59 | +
|
| 60 | + - name: Upload to GitHub Release |
| 61 | + if: github.event_name == 'release' && github.event.action == 'created' |
| 62 | + uses: actions/upload-release-asset@v1 |
| 63 | + with: |
| 64 | + upload_url: ${{ github.event.release.upload_url }} |
| 65 | + asset_path: target/flink-jar-runner-${{ env.VERSION }}.jar |
| 66 | + asset_name: flink-jar-runner-${{ env.VERSION }}.jar |
| 67 | + asset_content_type: application/java-archive |
0 commit comments