From a6d037f4ce230767d1a265fcc42d0cda6f70a13c Mon Sep 17 00:00:00 2001 From: AtaS Date: Tue, 15 Oct 2024 12:13:57 +0100 Subject: [PATCH 1/9] Update build-and-publish.yml --- .github/workflows/build-and-publish.yml | 40 +++++++++---------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 366e9fd..ebced18 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -94,7 +94,7 @@ jobs: permissions: contents: write needs: build_and_test - if: github.ref == 'refs/heads/main' +# if: github.ref == 'refs/heads/main' steps: - name: Checkout repository uses: actions/checkout@v4 @@ -115,31 +115,19 @@ jobs: if: steps.cache-jq.outputs.cache-hit != 'true' run: sudo apt-get install -y jq #endregion - - - name: Set next version - run: | - latest_release=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest) - current_version=$(echo "$latest_release" | jq -r .tag_name) - current_version=${current_version#v} # Remove the 'v' from the version if present - current_version=${current_version%-[a-zA-Z0-9]*} # Remove '-[a-zA-Z0-9]*' suffix if present - IFS='.' read -r major minor patch <<< "$current_version" - - # Increment the patch version - next_version="$major.$minor.$((patch + 1))" - - # Set the next version in the environment - echo "next_version=$next_version" - echo "next_version=$next_version" >> $GITHUB_ENV - - - name: Create GitHub Release - run: | - mv swpserver.tar.gz swpserver-$next_version.tar.gz - COMMIT_MSG=$(git log -1 --pretty=%B) - gh release create "v$next_version-dev" swpserver-$next_version.tar.gz\ - --title "Release v$next_version-dev" \ - --notes "$COMMIT_MSG" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: atas/bump-release-calver-action@main + +# - name: Create GitHub Release +# run: | +# next_version=${{ steps.bump-release-calver.outputs.next_version }}" +# mv swpserver.tar.gz swpserver-$next_version.tar.gz +# COMMIT_MSG=$(git log -1 --pretty=%B) +# gh release create "v$next_version-dev" swpserver-$next_version.tar.gz\ +# --title "Release v$next_version-dev" \ +# --notes "$COMMIT_MSG" +# env: +# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} deploy: From 54d2cec4f4c25c74c41d7d16ff1f1d23efb692c0 Mon Sep 17 00:00:00 2001 From: AtaS Date: Tue, 15 Oct 2024 12:16:43 +0100 Subject: [PATCH 2/9] Update build-and-publish.yml --- .github/workflows/build-and-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index ebced18..9ebc50b 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -117,6 +117,8 @@ jobs: #endregion - uses: atas/bump-release-calver-action@main + with: + github_token: ${{ secrets.GITHUB_TOKEN }} # - name: Create GitHub Release # run: | From 832aa3a5a0449a63bc8a30c14839587a02f57c87 Mon Sep 17 00:00:00 2001 From: AtaS Date: Tue, 15 Oct 2024 12:33:26 +0100 Subject: [PATCH 3/9] Update build-and-publish.yml --- .github/workflows/build-and-publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 9ebc50b..cf1a71d 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -116,7 +116,8 @@ jobs: run: sudo apt-get install -y jq #endregion - - uses: atas/bump-release-calver-action@main + - id: bump-release-calver + uses: atas/bump-release-calver-action@main with: github_token: ${{ secrets.GITHUB_TOKEN }} From acd4c32c5e50849cc4a60e56d1b61a26b160ce53 Mon Sep 17 00:00:00 2001 From: AtaS Date: Tue, 15 Oct 2024 12:35:55 +0100 Subject: [PATCH 4/9] Update build-and-publish.yml --- .github/workflows/build-and-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index cf1a71d..ea33322 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -121,6 +121,7 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} + # - name: Create GitHub Release # run: | # next_version=${{ steps.bump-release-calver.outputs.next_version }}" From 87ed39833cc408fa4801eb1cd02b6e701162bd69 Mon Sep 17 00:00:00 2001 From: AtaS Date: Tue, 15 Oct 2024 12:38:29 +0100 Subject: [PATCH 5/9] Update build-and-publish.yml --- .github/workflows/build-and-publish.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index ea33322..4e0ba0e 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -122,9 +122,10 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} -# - name: Create GitHub Release -# run: | -# next_version=${{ steps.bump-release-calver.outputs.next_version }}" + - name: Create GitHub Release + run: | + next_version=${{ steps.bump-release-calver.outputs.next_version }}" + echo "Next version: $next_version" # mv swpserver.tar.gz swpserver-$next_version.tar.gz # COMMIT_MSG=$(git log -1 --pretty=%B) # gh release create "v$next_version-dev" swpserver-$next_version.tar.gz\ From c6638d3c6ae6703ff1cc890d4f38372e5d3a9ff3 Mon Sep 17 00:00:00 2001 From: AtaS Date: Tue, 15 Oct 2024 12:42:05 +0100 Subject: [PATCH 6/9] Update build-and-publish.yml --- .github/workflows/build-and-publish.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 4e0ba0e..f2470cf 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -126,13 +126,13 @@ jobs: run: | next_version=${{ steps.bump-release-calver.outputs.next_version }}" echo "Next version: $next_version" -# mv swpserver.tar.gz swpserver-$next_version.tar.gz -# COMMIT_MSG=$(git log -1 --pretty=%B) -# gh release create "v$next_version-dev" swpserver-$next_version.tar.gz\ -# --title "Release v$next_version-dev" \ -# --notes "$COMMIT_MSG" -# env: -# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + mv swpserver.tar.gz swpserver-$next_version.tar.gz + COMMIT_MSG=$(git log -1 --pretty=%B) + gh release create "v$next_version" swpserver-$next_version.tar.gz\ + --title "Release v$next_version" \ + --notes "$COMMIT_MSG" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} deploy: From b489d32729099ab63f0a3a1face9f160e4126783 Mon Sep 17 00:00:00 2001 From: AtaS Date: Tue, 15 Oct 2024 12:47:35 +0100 Subject: [PATCH 7/9] Update build-and-publish.yml --- .github/workflows/build-and-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index f2470cf..d756bc1 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -124,8 +124,8 @@ jobs: - name: Create GitHub Release run: | - next_version=${{ steps.bump-release-calver.outputs.next_version }}" - echo "Next version: $next_version" + next_version="${{ steps.bump-release-calver.outputs.next_version }}" + echo "Next release version: $next_version" mv swpserver.tar.gz swpserver-$next_version.tar.gz COMMIT_MSG=$(git log -1 --pretty=%B) gh release create "v$next_version" swpserver-$next_version.tar.gz\ From 6b5e55ae727c8f6ca53ebd1e120cb3951f04eeeb Mon Sep 17 00:00:00 2001 From: AtaS Date: Tue, 15 Oct 2024 12:50:01 +0100 Subject: [PATCH 8/9] Update build-and-publish.yml --- .github/workflows/build-and-publish.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index d756bc1..60e66fd 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -94,7 +94,7 @@ jobs: permissions: contents: write needs: build_and_test -# if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' steps: - name: Checkout repository uses: actions/checkout@v4 @@ -120,8 +120,7 @@ jobs: uses: atas/bump-release-calver-action@main with: github_token: ${{ secrets.GITHUB_TOKEN }} - - + - name: Create GitHub Release run: | next_version="${{ steps.bump-release-calver.outputs.next_version }}" @@ -134,7 +133,6 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - deploy: runs-on: ubuntu-latest needs: release From 9ee1ec2fad2542194b350ca8cd0c1397b424eeb5 Mon Sep 17 00:00:00 2001 From: AtaS Date: Tue, 15 Oct 2024 13:05:42 +0100 Subject: [PATCH 9/9] Install jq only if not installed during the release --- .github/workflows/build-and-publish.yml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml index 60e66fd..fb42070 100644 --- a/.github/workflows/build-and-publish.yml +++ b/.github/workflows/build-and-publish.yml @@ -103,18 +103,14 @@ jobs: with: name: swpserver - #region jq - - name: Restore JQ cache - id: cache-jq - uses: actions/cache@v4 - with: - path: /usr/bin/jq - key: jq-${{ runner.os }}-${{ hashFiles('**/*.yml') }} - - - name: Setup JQ - if: steps.cache-jq.outputs.cache-hit != 'true' - run: sudo apt-get install -y jq - #endregion + - name: Check if jq is installed + run: | + if ! command -v jq &> /dev/null; then + echo "jq is not installed. Installing..." + sudo apt-get install -y jq + else + echo "jq is already installed." + fi - id: bump-release-calver uses: atas/bump-release-calver-action@main