From 285ff89cb081d3efbd600a411274d84507069060 Mon Sep 17 00:00:00 2001 From: triggermeelmo Date: Sat, 4 Oct 2025 13:20:58 +0200 Subject: [PATCH 1/5] d --- .gitea/workflows/build.yml | 71 +++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 86a5465..aa0df03 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -2,16 +2,9 @@ name: Gitea CI/CD on: workflow_dispatch: - #push: - #branches: [ "development", "main", "staging"] - #tags: [ "v*.*.*" ] - pull_request: - #branches: [ "development", "main", "staging" ] - tags: [ "v*.*.*" ] - -permissions: - contents: write - packages: write + push: + branches: [ "development", "main", "staging" ] + tags: [ "v*.*.*" ] env: DOTNET_VERSION: '8.0.x' @@ -19,6 +12,10 @@ env: REGISTRY_URL: git.triggermeelmo.com DOCKER_PLATFORMS: 'linux/amd64,linux/arm64' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build-and-test: runs-on: ubuntu-latest @@ -46,13 +43,14 @@ jobs: set-tag: name: Set Tag Name + needs: [detect-project, build] + #if: ${{ !failure() && !cancelled() && github.event_name != 'pull_request' }} runs-on: ubuntu-latest outputs: tag_name: ${{ steps.set_tag.outputs.tag_name }} + should_tag: ${{ steps.set_tag.outputs.should_tag }} steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Determine next semantic version tag id: set_tag @@ -74,17 +72,27 @@ jobs: major=$((major + 1)) minor=0 patch=0 + new_tag="v${major}.${minor}.${patch}" + echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT + echo "should_tag=true" >> $GITHUB_OUTPUT + echo "Creating new major version tag: ${new_tag}" + elif [[ "${GITHUB_REF}" == "refs/heads/development" ]]; then minor=$((minor + 1)) patch=0 + new_tag="v${major}.${minor}.${patch}" + echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT + echo "should_tag=true" >> $GITHUB_OUTPUT + echo "Creating new minor version tag: ${new_tag}" + elif [[ "${GITHUB_REF}" == "refs/heads/staging" ]]; then patch=$((patch + 1)) + new_tag="v${major}.${minor}.${patch}" + echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT + echo "should_tag=true" >> $GITHUB_OUTPUT + echo "Creating new patch version tag: ${new_tag}" fi - new_tag="v${major}.${minor}.${patch}" - echo "Creating new version tag: ${new_tag}" - echo "tag_name=${new_tag}" >> $GITHUB_OUTPUT - docker-build-and-push: runs-on: ubuntu-latest needs: [build-and-test, set-tag] @@ -111,37 +119,22 @@ jobs: tag: name: Create Tag - needs: [docker-build-and-push] + needs: [docker-build, build, set-tag] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: Check if tag already exists - id: check_tag + - name: Set up Git user run: | - git fetch --tags - if git rev-parse "${{ needs.set-tag.outputs.tag_name }}" >/dev/null 2>&1; then - echo "Tag ${{ needs.set-tag.outputs.tag_name }} already exists!" - echo "exists=true" >> $GITHUB_OUTPUT - else - echo "Tag ${{ needs.set-tag.outputs.tag_name }} does not exist" - echo "exists=false" >> $GITHUB_OUTPUT - fi - - - name: Create and push tag - if: steps.check_tag.outputs.exists == 'false' - run: | - echo "Creating new tag: ${{ needs.set-tag.outputs.tag_name }}" git config user.name "GitHub Actions" git config user.email "actions@github.com" - git tag ${{ needs.set-tag.outputs.tag_name }} - git push -u origin ${{ needs.set-tag.outputs.tag_name }} - echo "Tag created and pushed successfully" - - name: Skip tag creation - if: steps.check_tag.outputs.exists == 'true' + - name: Create and push tag + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - echo "Skipping tag creation - ${{ needs.set-tag.outputs.tag_name }} already exists" \ No newline at end of file + echo "Creating new tag: ${{ needs.set-tag.outputs.tag_name }}" + git tag ${{ needs.set-tag.outputs.tag_name }} + git push origin ${{ needs.set-tag.outputs.tag_name }} \ No newline at end of file From e385eb94f4663c24c42057a29bbf4dc9dcb5d5d0 Mon Sep 17 00:00:00 2001 From: triggermeelmo Date: Sat, 4 Oct 2025 13:26:08 +0200 Subject: [PATCH 2/5] e --- .gitea/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index aa0df03..e98344c 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -43,7 +43,7 @@ jobs: set-tag: name: Set Tag Name - needs: [detect-project, build] + needs: [build-and-test] #if: ${{ !failure() && !cancelled() && github.event_name != 'pull_request' }} runs-on: ubuntu-latest outputs: @@ -114,12 +114,12 @@ jobs: run: | docker buildx build \ --platform ${{ env.DOCKER_PLATFORMS }} \ - -t ${{ env.REGISTRY_URL }}/watcher/${{ env.DOCKER_IMAGE_NAME }}:${{ needs.set-tag.outputs.tag_name }} \ + -t ${{ env.REGISTRY_URL }}/watcher/${{ env.DOCKER_IMAGE_NAME }}:${{ needs.set_tag.outputs.tag_name }} \ --push . tag: name: Create Tag - needs: [docker-build, build, set-tag] + needs: [docker-build-and-push] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From b012693c21a5aa47bbeb02ec113c10aa8a501da3 Mon Sep 17 00:00:00 2001 From: triggermeelmo Date: Sat, 4 Oct 2025 13:29:28 +0200 Subject: [PATCH 3/5] f --- .gitea/workflows/build.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index e98344c..3883da8 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -3,8 +3,8 @@ name: Gitea CI/CD on: workflow_dispatch: push: - branches: [ "development", "main", "staging" ] - tags: [ "v*.*.*" ] + branches: [ "development", "main", "staging" ] + tags: [ "v*.*.*" ] env: DOTNET_VERSION: '8.0.x' @@ -96,6 +96,9 @@ jobs: docker-build-and-push: runs-on: ubuntu-latest needs: [build-and-test, set-tag] + if: | + needs.set-tag.outputs.should_tag == 'true' && + github.event_name != 'pull_request' steps: - name: Checkout code uses: actions/checkout@v4 From 286f72eac747ff459b371744fa5066a1946f4ed4 Mon Sep 17 00:00:00 2001 From: donpat1to Date: Sat, 4 Oct 2025 13:32:28 +0200 Subject: [PATCH 4/5] moved watcher-server to watcher --- .gitea/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index e98344c..dcfb3e0 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -8,7 +8,7 @@ on: env: DOTNET_VERSION: '8.0.x' - DOCKER_IMAGE_NAME: watcher-server + DOCKER_IMAGE_NAME: watcher REGISTRY_URL: git.triggermeelmo.com DOCKER_PLATFORMS: 'linux/amd64,linux/arm64' From 4c6635f9891f42f5a01bd9ec28bbd9530e9600a9 Mon Sep 17 00:00:00 2001 From: donpat1to Date: Sat, 4 Oct 2025 13:40:17 +0200 Subject: [PATCH 5/5] fixed misspelling set_tag to set-tag --- .gitea/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 2dacc08..90470c5 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -117,7 +117,7 @@ jobs: run: | docker buildx build \ --platform ${{ env.DOCKER_PLATFORMS }} \ - -t ${{ env.REGISTRY_URL }}/watcher/${{ env.DOCKER_IMAGE_NAME }}:${{ needs.set_tag.outputs.tag_name }} \ + -t ${{ env.REGISTRY_URL }}/watcher/${{ env.DOCKER_IMAGE_NAME }}:${{ needs.set-tag.outputs.tag_name }} \ --push . tag: