From a315e672ed523a48f3eb1fdd23176d7c4aa298ec Mon Sep 17 00:00:00 2001 From: Remko Date: Tue, 17 Dec 2024 09:29:08 +0100 Subject: [PATCH 1/2] Updated workflows --- .../pull-request-from-branch-check.yaml | 30 ++++++------- .github/workflows/release-workflow.yaml | 43 +++++++++++++++---- 2 files changed, 49 insertions(+), 24 deletions(-) diff --git a/.github/workflows/pull-request-from-branch-check.yaml b/.github/workflows/pull-request-from-branch-check.yaml index 401de613..1e0d2812 100644 --- a/.github/workflows/pull-request-from-branch-check.yaml +++ b/.github/workflows/pull-request-from-branch-check.yaml @@ -1,18 +1,18 @@ name: Main Branch Protection -#on: -# pull_request: -# branches: -# - main +on: + pull_request: + branches: + - main -#jobs: -# check-branch: -# runs-on: ubuntu-latest -# steps: -# - name: Check branch -# run: | -# if [[ ${GITHUB_HEAD_REF} != development ]] && [[ ${GITHUB_HEAD_REF} != documentation ]] && ! [[ ${GITHUB_HEAD_REF} =~ ^hotfix/ ]]; -# then -# echo "Error: Pull request must come from 'development', 'documentation' or 'hotfix/' branch" -# exit 1 -# fi +jobs: + check-branch: + runs-on: ubuntu-latest + steps: + - name: Check branch + run: | + if [[ ${GITHUB_HEAD_REF} != development ]] && [[ ${GITHUB_HEAD_REF} != documentation ]] && ! [[ ${GITHUB_HEAD_REF} =~ ^hotfix/ ]]; + then + echo "Error: Pull request must come from 'development', 'documentation' or 'hotfix/' branch" + exit 1 + fi diff --git a/.github/workflows/release-workflow.yaml b/.github/workflows/release-workflow.yaml index c40b6881..58b21f80 100644 --- a/.github/workflows/release-workflow.yaml +++ b/.github/workflows/release-workflow.yaml @@ -21,6 +21,7 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + ssh-key: ${{ secrets.DEPLOY_KEY }} - name: Set app env run: | @@ -44,7 +45,7 @@ jobs: run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git commit -am "Bump version to ${{ env.NEW_VERSION }}" + git commit -am "Bump version to ${{ env.NEW_VERSION }}" -m "[skip ci]" git push # Step 1: Prepare the signing certificate and key @@ -140,14 +141,6 @@ jobs: description=$(jq -r '.description' <(curl -s https://api.github.com/repos/${{ github.repository }})) echo "REPO_DESCRIPTION=$description" >> $GITHUB_ENV - # Step 13: Run Changelog CI - - name: Run Changelog CI - if: github.ref == 'refs/heads/main' - uses: saadmk11/changelog-ci@v1.1.2 - with: - release_version: ${{ env.NEW_VERSION }} - config_file: changelog-ci-config.json - # Step 14: Output the version - name: Use the version run: | @@ -194,3 +187,35 @@ jobs: tar -tvf nextcloud-release.tar.gz echo "info.xml contents:" tar -xOf nextcloud-release.tar.gz ${{ env.APP_NAME }}/appinfo/info.xml + + update-changelog: + runs-on: ubuntu-latest + steps: + + - name: Checkout Code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set app env + run: | + echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV + + - name: Get current version and increment + id: increment_version + run: | + current_version=$(grep -oP '(?<=)[^<]+' appinfo/info.xml) + IFS='.' read -ra version_parts <<< "$current_version" + ((version_parts[2]++)) + new_version="${version_parts[0]}.${version_parts[1]}.${version_parts[2]}" + echo "NEW_VERSION=$new_version" >> $GITHUB_ENV + echo "new_version=$new_version" >> $GITHUB_OUTPUT + + # Step 13: Run Changelog CI + - name: Run Changelog CI + if: github.ref == 'refs/heads/main' + uses: saadmk11/changelog-ci@v1.1.2 + with: + persist-credentials: true + release_version: ${{ env.NEW_VERSION }} + config_file: changelog-ci-config.json \ No newline at end of file From 21550842a85c697f3d8dc616d29c54b03af5c92f Mon Sep 17 00:00:00 2001 From: Remko Date: Tue, 17 Dec 2024 09:31:50 +0100 Subject: [PATCH 2/2] cleanup --- .github/workflows/release-workflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-workflow.yaml b/.github/workflows/release-workflow.yaml index 58b21f80..d869733b 100644 --- a/.github/workflows/release-workflow.yaml +++ b/.github/workflows/release-workflow.yaml @@ -218,4 +218,4 @@ jobs: with: persist-credentials: true release_version: ${{ env.NEW_VERSION }} - config_file: changelog-ci-config.json \ No newline at end of file + config_file: changelog-ci-config.json