From ab1ab6ef60caf97eb1a26c1de08ce98aed8c903e Mon Sep 17 00:00:00 2001 From: heavynimbus Date: Sat, 1 Jun 2024 00:53:03 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Add=20docker=20login?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upgrade-version.yml | 35 +++++++++++++++++++++------ get-next-version.sh | 3 +++ set-version.sh => set-next-version.sh | 0 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100755 get-next-version.sh rename set-version.sh => set-next-version.sh (100%) diff --git a/.github/workflows/upgrade-version.yml b/.github/workflows/upgrade-version.yml index d7f2326..9a10990 100644 --- a/.github/workflows/upgrade-version.yml +++ b/.github/workflows/upgrade-version.yml @@ -1,6 +1,9 @@ name: Build and Test on: + release: + types: + - published push: branches: - '*/*' @@ -10,11 +13,13 @@ jobs: runs-on: ubuntu-latest permissions: + packages: write contents: write steps: - - name: Checkout + - name: Check out the repo uses: actions/checkout@v4 + - name: Setup Java 21 uses: actions/setup-java@v4 with: @@ -22,10 +27,26 @@ jobs: java-version: '21.0.3' cache: 'maven' cache-dependency-path: 'server/pom.xml' - - name: Upgrade server version - run: | - ./set-version.sh --pom server/pom.xml - - name: Commit and push - uses: stefanzweifel/git-auto-commit-action@v5 + - name: Echo username + env: + USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + run: echo "Username is ${USERNAME}" + + - name: Docker Login + uses: docker/login-action@v3 with: - commit_message: "⬆️ Upgrade server version" + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + +# - name: Upgrade server version +# run: | +# ./set-version.sh --pom server/pom.xml +# +# - name: Commit and push new version +# uses: stefanzweifel/git-auto-commit-action@v5 +# with: +# commit_message: "⬆️ Upgrade server version to $(./get-next-version.sh)" +# +# - name: Build docker image +# run: | +# docker build -t heavy-mock-http-server:$(./get-next-version.sh) server \ No newline at end of file diff --git a/get-next-version.sh b/get-next-version.sh new file mode 100755 index 0000000..131eb7a --- /dev/null +++ b/get-next-version.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +grep -rE 'version.next=[0-9]+\.[0-9]+\.[0-9]+' version.properties | cut -d '=' -f2 diff --git a/set-version.sh b/set-next-version.sh similarity index 100% rename from set-version.sh rename to set-next-version.sh