From ab61499462307dad373cfe46f8be0ae6dedc81da Mon Sep 17 00:00:00 2001 From: niklasb99 Date: Mon, 8 Aug 2022 16:31:38 +0200 Subject: [PATCH] feat: improve dev processes --- .github/pull.yml | 12 +++++------ .github/workflows/dockerImage.yml | 30 ++++++++++++++++++++++++---- .github/workflows/feature-branch.yml | 7 +++---- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/.github/pull.yml b/.github/pull.yml index 6514f5c..741465e 100644 --- a/.github/pull.yml +++ b/.github/pull.yml @@ -1,7 +1,7 @@ -version: '1' +version: "1" rules: - - base: develop - upstream: Onlineberatung:develop - mergeMethod: merge -label: ':arrow_heading_down: pull' -conflictLabel: 'merge-conflict' + - base: develop + upstream: Onlineberatung:develop + mergeMethod: merge +label: ":arrow_heading_down: pull" +conflictLabel: "merge-conflict" diff --git a/.github/workflows/dockerImage.yml b/.github/workflows/dockerImage.yml index 46e5ca9..f76d98a 100644 --- a/.github/workflows/dockerImage.yml +++ b/.github/workflows/dockerImage.yml @@ -2,8 +2,11 @@ name: Publish Docker image on: push: + branches: + - "develop" tags: - - 'dockerImage.v.*' + - "dockerImage.v.*" + - "v*" jobs: test: @@ -37,6 +40,9 @@ jobs: name: targetfiles path: target/*.jar push_to_registry: + strategy: + matrix: + registry: ["docker.pkg.github.com", "ghcr.io"] needs: [test] name: Push Docker image to GitHub Packages runs-on: ubuntu-latest @@ -46,10 +52,26 @@ jobs: uses: actions/download-artifact@v2 with: name: targetfiles - - name: Prepare Docker variables + - name: Get current time + id: time + uses: nanzm/get-time-action@v1.1 + with: + timeZone: 2 + format: "YYYYMMDD[_]HHmmss" + - name: Prepare environment variables run: | - echo "DOCKER_REGISTRY=$(echo "docker.pkg.github.com/${{ github.repository }}" | awk '{print tolower($0)}')" >> $GITHUB_ENV + echo "DOCKER_REGISTRY=$(echo "${{ matrix.registry }}/${{ github.repository }}" | awk '{print tolower($0)}')" >> $GITHUB_ENV echo "DOCKER_IMAGE=$(echo "${{ github.repository }}" | awk -F / '{print tolower($2)}')" >> $GITHUB_ENV + echo BRANCH=$(echo -n "${GITHUB_REF#refs/heads/}") >> $GITHUB_ENV + echo TIME_STAMP=$(echo -n "${{ steps.time.outputs.time }}") >> $GITHUB_ENV + shell: bash + - name: Set tag for develop image + if: endsWith(env.BRANCH, 'develop') == true + run: echo DOCKER_IMAGE_TAG=$(echo "develop_${{ env.TIME_STAMP }}") >> $GITHUB_ENV + shell: bash + - name: Set tag for default image + if: endsWith(env.BRANCH, 'develop') == false + run: echo DOCKER_IMAGE_TAG=$(echo "${GITHUB_REF/refs\/tags\//}") >> $GITHUB_ENV shell: bash - name: Push to GitHub Packages uses: docker/build-push-action@v1.1.1 @@ -58,4 +80,4 @@ jobs: password: ${{ secrets.GH_PACKAGE_RELEASE_TOKEN }} registry: ${{ env.DOCKER_REGISTRY }} repository: ${{ env.DOCKER_IMAGE }} - tag_with_ref: true + tags: ${{ env.DOCKER_IMAGE_TAG}} diff --git a/.github/workflows/feature-branch.yml b/.github/workflows/feature-branch.yml index c20e5b2..95357a1 100644 --- a/.github/workflows/feature-branch.yml +++ b/.github/workflows/feature-branch.yml @@ -3,15 +3,14 @@ name: Feature Branch on: push: branches-ignore: - - 'master' - - 'develop' + - "master" + - "develop" jobs: test: name: Build and run unit tests runs-on: ubuntu-latest steps: - - name: Checkout uses: actions/checkout@v2 @@ -34,4 +33,4 @@ jobs: run: mvn -B -Pprod clean package -DskipTests - name: Maven Verify - run: mvn -B -Pprod clean verify \ No newline at end of file + run: mvn -B -Pprod clean verify