Skip to content

Commit

Permalink
Merge pull request #243 from Consdata/automatic_release
Browse files Browse the repository at this point in the history
Github Actions automatic release
  • Loading branch information
ynleborg authored Apr 5, 2022
2 parents cb6250d + 14ddb1b commit c68a92d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,20 @@ jobs:
with:
java-version: '11'
distribution: 'adopt'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
- name: Build Project and Image
run: ./mvnw package -P dist
- name: Login to DockerHub
run: ./mvnw package -P dist
- name: Set version env variable
run: |
echo "MVN_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to Docker
run: docker push "consdata/kouncil:latest"
run: docker push "consdata/kouncil:${{ env.MVN_VERSION }}"
- name: Tag Latest Snapshot
run: docker tag "consdata/kouncil:${{ env.MVN_VERSION }}" "consdata/kouncil:latest_snapshot"
- name: Push to Docker
run: docker push "consdata/kouncil:latest_snapshot"
19 changes: 18 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ jobs:
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
- name: Publish JAR
run: ./mvnw -B release:prepare release:perform
run: ./mvnw -B release:prepare release:perform -P dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout last tag
run: |
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)
- name: Set version env variable
run: |
echo "MVN_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push to Docker
run: docker push "consdata/kouncil:${{ env.MVN_VERSION }}"
- name: Tag Latest Snapshot
run: docker tag "consdata/kouncil:${{ env.MVN_VERSION }}" "consdata/kouncil:latest"
- name: Push to Docker
run: docker push "consdata/kouncil:latest"
1 change: 1 addition & 0 deletions kouncil-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
</executions>
<configuration>
<repository>consdata/kouncil</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
Expand Down

0 comments on commit c68a92d

Please sign in to comment.