Skip to content

Commit 509de7a

Browse files
committed
Build and publish releases
1 parent de4220d commit 509de7a

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

.github/workflows/docker-publish.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Publish Docker Image
22

33
on:
4+
release:
5+
types: [created]
46
push:
57
branches:
68
- main
@@ -17,6 +19,7 @@ jobs:
1719

1820
env:
1921
DOCKER_REPO: datasqrl/flink-jar-runner
22+
VERSION: ${{ github.event_name == 'release' && github.event.action == 'created' && github.ref_name || 'snapshot' }}
2023

2124
steps:
2225
- name: Checkout code
@@ -26,6 +29,7 @@ jobs:
2629
uses: docker/setup-buildx-action@v2
2730

2831
- name: Log in to Docker Hub
32+
if: github.event_name == 'release' && github.event.action == 'created'
2933
uses: docker/login-action@v2
3034
with:
3135
username: ${{ secrets.DOCKER_USERNAME }}
@@ -36,9 +40,28 @@ jobs:
3640
docker pull gradle:8.6-jdk11
3741
docker pull flink:1.19.1-scala_2.12-java11
3842
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
4050
working-directory: flink-dockerfile-example
4151
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 }}
4353
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: |
4458
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

Comments
 (0)