From add9f7f31955f9c6e3609fbb6fe484af76c7c917 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 22:30:58 +0200 Subject: [PATCH 01/56] Add new release workflow with version bumping and automated checks --- .github/workflows/manual_release.yml | 80 --------------- .github/workflows/release.yml | 144 +++++++++++++++++++++++++++ 2 files changed, 144 insertions(+), 80 deletions(-) delete mode 100644 .github/workflows/manual_release.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml deleted file mode 100644 index 464e547..0000000 --- a/.github/workflows/manual_release.yml +++ /dev/null @@ -1,80 +0,0 @@ -name: Manual Release -on: - workflow_dispatch: - inputs: - version_increase: - description: 'Level of changes for new version' - required: true - default: 'patch' - type: choice - options: - - patch - - minor - - major - - -jobs: - release: - runs-on: ubuntu-latest - permissions: - pull-requests: write - contents: write - - steps: - - name: Checkout - id: checkout - uses: actions/checkout@v4 - - - name: Use Node.js 18.x - uses: actions/setup-node@v4 - with: - node-version: 18.x - - - name: Install Dependencies - run: npm install - - - name: Bump version - id: version-bump - uses: 4Source/version-control-action@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - owner: ${{ github.repository_owner }} - repository: ${{ github.event.repository.name }} - version_increase: ${{ inputs.version_increase }} - tag_prefix: '' - dry_run: true - - - name: Configure git - run: | - git config --global user.name "4Source" - git config --global user.email "38220764+4Source@users.noreply.github.com." - - - name: Change version in files - run: | - npm run version -- --new_version=${{ steps.version-bump.outputs.new_version }} - git add manifest.json versions.json package.json - - - name: Commit and push changes - run: | - git commit -a -m "Apply version ${{ steps.version-bump.outputs.new_version }}" - git push -f - - - name: Push version tag - run: | - git tag -a ${{ steps.version-bump.outputs.new_version }} -m "${{ steps.version-bump.outputs.new_version }}" - git push -f origin ${{ steps.version-bump.outputs.new_version }} - - - name: Build plugin - run: npm run build - - - name: Create release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - FILES="main.js manifest.json" - if [ -f styles.css ]; then - FILES="$FILES styles.css" - fi - gh release create "${{ steps.version-bump.outputs.new_version }}" \ - --title "${{ steps.version-bump.outputs.new_version }}" \ - --draft $FILES diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0dedb65 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,144 @@ +name: Release new plugin version +on: + workflow_dispatch: + inputs: + selected_release_type: + description: "Choose version update type" + required: true + default: 'auto' + type: choice + options: + - patch + - minor + - major + + schedule: + # Schedule automatic release every Wednesday + - cron: '0 0 * * 3' + + +jobs: + release: + runs-on: ubuntu-latest + permissions: + pull-requests: write + contents: write + + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v4 + + - name: Use Node.js 18.x + uses: actions/setup-node@v4 + with: + node-version: 18.x + + - name: Check changes since last release + id: changes + run: | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "${{ inputs.selected_release_type }} changes requested." + echo "::set-output name=release_type::${{ inputs.selected_release_type }}" + fi + + # Find the latest semver tag + LAST_VERSION_TAG=$(git tag --list | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | grep -v '-' | sort -V | tail -n1 || echo "") + + if [ -z "$LAST_VERSION_TAG" ]; then + echo "No previous tag found. First release has to be a manual release." + exit 1 + else + echo "Last tag: $LAST_VERSION_TAG" + if git diff --quiet "$LAST_VERSION_TAG"..HEAD -- src/; then + echo "No changes in /src since last release." + exit 0 + else + # Find the highest release type + if git tag --list | grep -q 'major'; then + RELEASE_TYPE_TAG="major" + elif git tag --list | grep -q 'minor'; then + RELEASE_TYPE_TAG="minor" + elif git tag --list | grep -q 'patch'; then + RELEASE_TYPE_TAG="patch" + else + RELEASE_TYPE_TAG="" + fi + + if [ -z "$RELEASE_TYPE_TAG" ]; then + echo "No tag found matching a release type." + exit 1 + fi + + echo "$RELEASE_TYPE_TAG changes detected in /src since last release." + echo "::set-output name=release_type::$RELEASE_TYPE_TAG" + fi + fi + + - name: Install Dependencies + run: npm install + + - name: Bump version + id: version-bump + uses: 4Source/version-control-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + owner: ${{ github.repository_owner }} + repository: ${{ github.event.repository.name }} + version_increase: ${{ steps.changes.outputs.release_type }} + tag_prefix: '' + dry_run: true + + - name: Configure git + run: | + git config --global user.name "4Source" + git config --global user.email "38220764+4Source@users.noreply.github.com" + + - name: Change version in files + run: | + npm run version -- --new_version=${{ steps.version-bump.outputs.new_version }} + git add manifest.json versions.json package.json + + - name: Commit and push changes + run: | + git commit -a -m "Apply version ${{ steps.version-bump.outputs.new_version }}" + git push + + - name: Push version tag + run: | + git tag -a ${{ steps.version-bump.outputs.new_version }} -m "${{ steps.version-bump.outputs.new_version }}" + git push origin ${{ steps.version-bump.outputs.new_version }} + + - name: Build plugin + id: build-plugin + run: | + npm run build + + if [ ! -f main.js ]; then + echo "Error: main.js is missing." + exit 1 + fi + + if [ ! -f manifest.json ]; then + echo "Error: manifest.json is missing." + exit 1 + fi + + FILES="main.js manifest.json" + if [ -f styles.css ]; then + FILES="$FILES styles.css" + fi + echo "::set-output name=release_files::$FILES" + + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + FILES="main.js manifest.json" + if [ -f styles.css ]; then + FILES="$FILES styles.css" + fi + gh release create "${{ steps.version-bump.outputs.new_version }}" \ + --title "${{ steps.version-bump.outputs.new_version }}" \ + --draft \ + ${{ steps.build-plugin.outputs.release_files }} From 5eedc6f7276e3c36a5aace5a0403eb14a05f297b Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 22:32:57 +0200 Subject: [PATCH 02/56] For testing purposes rename back to old name --- .github/workflows/{release.yml => manual_release.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{release.yml => manual_release.yml} (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/manual_release.yml similarity index 100% rename from .github/workflows/release.yml rename to .github/workflows/manual_release.yml From 1921ddf35454b5b758d840196ae8dd3ed9fcd200 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 22:36:30 +0200 Subject: [PATCH 03/56] Change deprecated set-output --- .github/workflows/manual_release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 0dedb65..64fb569 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -39,7 +39,7 @@ jobs: run: | if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then echo "${{ inputs.selected_release_type }} changes requested." - echo "::set-output name=release_type::${{ inputs.selected_release_type }}" + echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT fi # Find the latest semver tag @@ -71,7 +71,7 @@ jobs: fi echo "$RELEASE_TYPE_TAG changes detected in /src since last release." - echo "::set-output name=release_type::$RELEASE_TYPE_TAG" + echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT fi fi @@ -128,7 +128,7 @@ jobs: if [ -f styles.css ]; then FILES="$FILES styles.css" fi - echo "::set-output name=release_files::$FILES" + echo "release_files=$FILES" >> $GITHUB_OUTPUT - name: Create release env: From 82133c8864aaa86423102c67fd68f22ad7ae14b8 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 22:45:24 +0200 Subject: [PATCH 04/56] Fix checkout step to ensure correct ref is used --- .github/workflows/manual_release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 64fb569..1c759bb 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -28,6 +28,8 @@ jobs: - name: Checkout id: checkout uses: actions/checkout@v4 + with: + ref: ${{ github.event.ref }} - name: Use Node.js 18.x uses: actions/setup-node@v4 From 5865ad97e763ec822d10a5e0239e7a5b479e610a Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 22:47:24 +0200 Subject: [PATCH 05/56] add git status for bug fixing --- .github/workflows/manual_release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 1c759bb..6ce32d3 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -39,6 +39,7 @@ jobs: - name: Check changes since last release id: changes run: | + git status if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then echo "${{ inputs.selected_release_type }} changes requested." echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT From 119c058a740607a2bbca77ac43cb00bab50ba425 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 22:50:38 +0200 Subject: [PATCH 06/56] Add fetch-tags option to checkout step in manual release workflow --- .github/workflows/manual_release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 6ce32d3..93b306f 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -30,6 +30,7 @@ jobs: uses: actions/checkout@v4 with: ref: ${{ github.event.ref }} + fetch-tags: 'true' - name: Use Node.js 18.x uses: actions/setup-node@v4 @@ -40,6 +41,9 @@ jobs: id: changes run: | git status + + git tag --list + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then echo "${{ inputs.selected_release_type }} changes requested." echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT From 8f9a884982b70e0f864aae0b74c996f6d12b4062 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 22:57:26 +0200 Subject: [PATCH 07/56] Set fetch depth for checkout --- .github/workflows/manual_release.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 93b306f..2652f1f 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -31,6 +31,9 @@ jobs: with: ref: ${{ github.event.ref }} fetch-tags: 'true' + fetch-depth: '100' + + - run: git tag --list - name: Use Node.js 18.x uses: actions/setup-node@v4 @@ -40,10 +43,6 @@ jobs: - name: Check changes since last release id: changes run: | - git status - - git tag --list - if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then echo "${{ inputs.selected_release_type }} changes requested." echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT From b66578738624cd78de21fb7046b6a8679214b2f2 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 23:01:17 +0200 Subject: [PATCH 08/56] Test changes for release workflow --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 80b9ec8..8b46892 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,7 +13,7 @@ export default class MyPlugin extends Plugin { } onunload() { - + // TEST CHANGES FOR RELEASE WORKFLOW } async loadSettings() { From 1ae1f28d33b1ba193ea3010554d3a34da1f673ce Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 23:08:15 +0200 Subject: [PATCH 09/56] Add to workflow_dispatch automatic version selection --- .github/workflows/manual_release.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 2652f1f..177f8be 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -8,6 +8,7 @@ on: default: 'auto' type: choice options: + - auto - patch - minor - major @@ -32,8 +33,6 @@ jobs: ref: ${{ github.event.ref }} fetch-tags: 'true' fetch-depth: '100' - - - run: git tag --list - name: Use Node.js 18.x uses: actions/setup-node@v4 @@ -45,7 +44,11 @@ jobs: run: | if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then echo "${{ inputs.selected_release_type }} changes requested." - echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT + + if [ "${{ inputs.selected_release_type }}" -ne "auto" ]; then + echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT + exit 0 + fi fi # Find the latest semver tag @@ -94,6 +97,7 @@ jobs: version_increase: ${{ steps.changes.outputs.release_type }} tag_prefix: '' dry_run: true + # TODO: Changes necessary to accept ref (branch) - name: Configure git run: | From 37f05858febcec4593d403b4e8b09995a0c160d6 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 23:15:03 +0200 Subject: [PATCH 10/56] Improved logging --- .github/workflows/manual_release.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 177f8be..64b9350 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -43,8 +43,8 @@ jobs: id: changes run: | if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - echo "${{ inputs.selected_release_type }} changes requested." - + echo "Requested release type: ${{ inputs.selected_release_type }}" + if [ "${{ inputs.selected_release_type }}" -ne "auto" ]; then echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT exit 0 @@ -79,7 +79,9 @@ jobs: exit 1 fi - echo "$RELEASE_TYPE_TAG changes detected in /src since last release." + echo "::debug::Changes detected in /src since last release." + + echo "Release tag: $RELEASE_TYPE_TAG" echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT fi fi @@ -152,3 +154,8 @@ jobs: --title "${{ steps.version-bump.outputs.new_version }}" \ --draft \ ${{ steps.build-plugin.outputs.release_files }} + + - name: Remove release type tags + run: | + echo "TODO" + exit 1 \ No newline at end of file From 5bb8e00137dccab2d2c74f6803f9793a34ce9b30 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 23:18:14 +0200 Subject: [PATCH 11/56] Use error logging --- .github/workflows/manual_release.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 64b9350..093b753 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -55,8 +55,7 @@ jobs: LAST_VERSION_TAG=$(git tag --list | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | grep -v '-' | sort -V | tail -n1 || echo "") if [ -z "$LAST_VERSION_TAG" ]; then - echo "No previous tag found. First release has to be a manual release." - exit 1 + echo "::error::No previous tag found. First release has to be a manual release." else echo "Last tag: $LAST_VERSION_TAG" if git diff --quiet "$LAST_VERSION_TAG"..HEAD -- src/; then @@ -75,8 +74,7 @@ jobs: fi if [ -z "$RELEASE_TYPE_TAG" ]; then - echo "No tag found matching a release type." - exit 1 + echo "::error::No tag found matching a release type." fi echo "::debug::Changes detected in /src since last release." From 315c29a96f8868c6e32e27645b0881032867ffc7 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 23:21:17 +0200 Subject: [PATCH 12/56] exit 1 on error --- .github/workflows/manual_release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 093b753..625a47f 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -56,6 +56,7 @@ jobs: if [ -z "$LAST_VERSION_TAG" ]; then echo "::error::No previous tag found. First release has to be a manual release." + exit 1 else echo "Last tag: $LAST_VERSION_TAG" if git diff --quiet "$LAST_VERSION_TAG"..HEAD -- src/; then @@ -75,6 +76,7 @@ jobs: if [ -z "$RELEASE_TYPE_TAG" ]; then echo "::error::No tag found matching a release type." + exit 1 fi echo "::debug::Changes detected in /src since last release." From 988f2ba28c6ea16f70e39dd32630bf0f5f77b0ee Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 11 Sep 2025 23:25:41 +0200 Subject: [PATCH 13/56] Fix comparison of auto --- .github/workflows/manual_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 625a47f..9910063 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -45,7 +45,7 @@ jobs: if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then echo "Requested release type: ${{ inputs.selected_release_type }}" - if [ "${{ inputs.selected_release_type }}" -ne "auto" ]; then + if [ "${{ inputs.selected_release_type }}" != "auto" ]; then echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT exit 0 fi From f7003ddf7f628f6bceb444fc6b12dd531ed171de Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 13:38:20 +0200 Subject: [PATCH 14/56] Edit manual release --- .github/workflows/manual_release.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index 9910063..dd41705 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -28,11 +28,13 @@ jobs: steps: - name: Checkout id: checkout - uses: actions/checkout@v4 + uses: actions/checkout@0548471950d86b19eae6c063105707c831fb5c03 with: ref: ${{ github.event.ref }} - fetch-tags: 'true' - fetch-depth: '100' + fetch-depth: 0 + fetch-tags: false + + - run: git tag --list - name: Use Node.js 18.x uses: actions/setup-node@v4 @@ -51,6 +53,8 @@ jobs: fi fi + echo "::debug::Tags: git tag --list" + # Find the latest semver tag LAST_VERSION_TAG=$(git tag --list | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | grep -v '-' | sort -V | tail -n1 || echo "") @@ -63,6 +67,8 @@ jobs: echo "No changes in /src since last release." exit 0 else + echo "::debug::Changes detected in /src since last release." + # Find the highest release type if git tag --list | grep -q 'major'; then RELEASE_TYPE_TAG="major" @@ -79,10 +85,9 @@ jobs: exit 1 fi - echo "::debug::Changes detected in /src since last release." echo "Release tag: $RELEASE_TYPE_TAG" - echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT + echo "release_type=$RELEASE_TYPE_TAG" >> $GITHUB_OUTPUT fi fi From 49af109fd65138fe7e915420343d9dd77012281e Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 13:43:07 +0200 Subject: [PATCH 15/56] Fetch tags --- .github/workflows/manual_release.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/manual_release.yml b/.github/workflows/manual_release.yml index dd41705..abdde31 100644 --- a/.github/workflows/manual_release.yml +++ b/.github/workflows/manual_release.yml @@ -31,10 +31,7 @@ jobs: uses: actions/checkout@0548471950d86b19eae6c063105707c831fb5c03 with: ref: ${{ github.event.ref }} - fetch-depth: 0 - fetch-tags: false - - - run: git tag --list + fetch-tags: true - name: Use Node.js 18.x uses: actions/setup-node@v4 From 5cc403249d1b01d1e1b057a3ee16b7ce52339b00 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:25:44 +0200 Subject: [PATCH 16/56] Update Continuous Deployment to Continuous Delivery --- .github/workflows/cd.yml | 79 +++++++------------ .github/workflows/ci.yml | 1 - .../{manual_release.yml => release.yml} | 0 3 files changed, 27 insertions(+), 53 deletions(-) rename .github/workflows/{manual_release.yml => release.yml} (100%) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3e84c14..57c16fd 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,74 +1,49 @@ -name: Continuous Deployment +name: Continuous Delivery on: pull_request: types: - closed - branches: - - master - workflow_dispatch: + # branches: + # - master jobs: release: runs-on: ubuntu-latest if: github.event.pull_request.merged == true - permissions: - pull-requests: write - contents: write + # permissions: + # pull-requests: write + # contents: write steps: - name: Checkout id: checkout uses: actions/checkout@v4 - - name: Use Node.js 18.x - uses: actions/setup-node@v4 - with: - node-version: 18.x - - - name: Install Dependencies - run: npm install + - name: Process Pull Request + id: process-pr + run: | + # TODO: From pull request get the tag to set the release type + echo "::debug::Labels: ${{ github.event.pull_request.labels }}" - - name: Bump version - id: version-bump - uses: 4Source/version-control-action@v1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - owner: ${{ github.repository_owner }} - repository: ${{ github.event.repository.name }} - pr_number: ${{ github.event.number }} - tag_prefix: '' - dry_run: true + if ${{ github.event.pull_request.labels }} | grep -q 'major'; then + RELEASE_TYPE_TAG="major" + elif ${{ github.event.pull_request.labels }} | grep -q 'minor'; then + RELEASE_TYPE_TAG="minor" + elif ${{ github.event.pull_request.labels }} | grep -q 'patch'; then + RELEASE_TYPE_TAG="patch" + else + RELEASE_TYPE_TAG="" + fi + + echo "Release tag: $RELEASE_TYPE_TAG" + echo "release_type=$RELEASE_TYPE_TAG" >> $GITHUB_OUTPUT - name: Configure git run: | git config --global user.name "4Source" - git config --global user.email "38220764+4Source@users.noreply.github.com." - - - name: Change version in files - run: | - npm run version -- --new_version=${{ steps.version-bump.outputs.new_version }} + git config --global user.email "38220764+4Source@users.noreply.github.com" - - name: Commit and push changes + - name: Create or Update release type tag run: | - git commit -a -m "Apply version ${{ steps.version-bump.outputs.new_version }}" - git push -f - - - name: Push version tag - run: | - git tag -a ${{ steps.version-bump.outputs.new_version }} -m "${{ steps.version-bump.outputs.new_version }}" - git push -f origin ${{ steps.version-bump.outputs.new_version }} - - - name: Build plugin - run: npm run build - - - name: Create release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - FILES="main.js manifest.json" - if [ -f styles.css ]; then - FILES="$FILES styles.css" - fi - gh release create "${{ steps.version-bump.outputs.new_version }}" \ - --title "${{ steps.version-bump.outputs.new_version }}" \ - --draft $FILES + git tag -fa ${{ steps.process-pr.outputs.release_type }} -m "${{ steps.process-pr.outputs.release_type }}" + git push origin -f ${{ steps.process-pr.outputs.release_type }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13561f1..6c32163 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,6 @@ on: paths: - 'src/**' - 'test/**' - workflow_dispatch: jobs: test: diff --git a/.github/workflows/manual_release.yml b/.github/workflows/release.yml similarity index 100% rename from .github/workflows/manual_release.yml rename to .github/workflows/release.yml From 34a1f54b1e59e407578ea9b01d35b318d9516071 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:46:16 +0200 Subject: [PATCH 17/56] Test changes in /src (#36) * Test changes in /src * Continuous Integration on default branch * Change Continuous Integration default branch condition --- .github/workflows/ci.yml | 10 +++++----- src/main.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c32163..ddec986 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,14 +2,10 @@ name: Continuous Integration on: pull_request: - branches: - - master paths: - 'src/**' - 'test/**' push: - branches: - - master paths: - 'src/**' - 'test/**' @@ -22,6 +18,7 @@ jobs: name: Run unit tests runs-on: ${{ matrix.os }} + if: always() && github.ref == github.event.repository.default_branch steps: - name: Checkout repository @@ -41,6 +38,7 @@ jobs: lint: name: Run linter runs-on: ubuntu-latest + if: always() && github.ref == github.event.repository.default_branch steps: - name: Checkout repository @@ -60,6 +58,7 @@ jobs: build: name: Build Plugin runs-on: ubuntu-latest + if: always() && github.ref == github.event.repository.default_branch steps: - name: Checkout repository @@ -79,6 +78,7 @@ jobs: audit: name: Security Audit runs-on: ubuntu-latest + if: always() && github.ref == github.event.repository.default_branch steps: - name: Checkout repository @@ -98,7 +98,7 @@ jobs: version: name: Version Bump runs-on: ubuntu-latest - if: github.event_name == 'pull_request' + if: always() && github.ref == github.event.repository.default_branch && github.event_name == 'pull_request' permissions: pull-requests: write diff --git a/src/main.ts b/src/main.ts index 8b46892..ac3247e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,7 +13,7 @@ export default class MyPlugin extends Plugin { } onunload() { - // TEST CHANGES FOR RELEASE WORKFLOW + // TEST CHANGES FOR RELEASE WORKFLOW 1 } async loadSettings() { From a610ef8c2ba348a52b0c7c9bb48fdd50400e6360 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:50:02 +0200 Subject: [PATCH 18/56] Continuous Integration only on push --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddec986..51334e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,10 @@ name: Continuous Integration on: - pull_request: - paths: - - 'src/**' - - 'test/**' + # pull_request: + # paths: + # - 'src/**' + # - 'test/**' push: paths: - 'src/**' From 346e58759ae4932978621b38c3c1967f001270b0 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:52:41 +0200 Subject: [PATCH 19/56] Remove If --- .github/workflows/ci.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51334e7..4bb1824 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,6 @@ jobs: name: Run unit tests runs-on: ${{ matrix.os }} - if: always() && github.ref == github.event.repository.default_branch steps: - name: Checkout repository @@ -38,7 +37,6 @@ jobs: lint: name: Run linter runs-on: ubuntu-latest - if: always() && github.ref == github.event.repository.default_branch steps: - name: Checkout repository @@ -58,7 +56,6 @@ jobs: build: name: Build Plugin runs-on: ubuntu-latest - if: always() && github.ref == github.event.repository.default_branch steps: - name: Checkout repository @@ -78,7 +75,6 @@ jobs: audit: name: Security Audit runs-on: ubuntu-latest - if: always() && github.ref == github.event.repository.default_branch steps: - name: Checkout repository @@ -98,7 +94,7 @@ jobs: version: name: Version Bump runs-on: ubuntu-latest - if: always() && github.ref == github.event.repository.default_branch && github.event_name == 'pull_request' + if: github.event_name == 'pull_request' permissions: pull-requests: write From 583d0020d444b1d294943480e47d865577351b47 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:54:11 +0200 Subject: [PATCH 20/56] Test changes to /src (#37) --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index ac3247e..b78f2a4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,7 +13,7 @@ export default class MyPlugin extends Plugin { } onunload() { - // TEST CHANGES FOR RELEASE WORKFLOW 1 + // TEST CHANGES FOR RELEASE WORKFLOW 2 } async loadSettings() { From d537d54ae13495c80fd80695e9d794a4acbe0806 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:58:15 +0200 Subject: [PATCH 21/56] Bring back pull request for Continuos Integration --- .github/workflows/cd.yml | 9 +++++---- .github/workflows/ci.yml | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 57c16fd..f5cd863 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -25,14 +25,15 @@ jobs: # TODO: From pull request get the tag to set the release type echo "::debug::Labels: ${{ github.event.pull_request.labels }}" - if ${{ github.event.pull_request.labels }} | grep -q 'major'; then + if echo "${{ github.event.pull_request.labels }}" | grep -q 'major'; then RELEASE_TYPE_TAG="major" - elif ${{ github.event.pull_request.labels }} | grep -q 'minor'; then + elif echo "${{ github.event.pull_request.labels }}" | grep -q 'minor'; then RELEASE_TYPE_TAG="minor" - elif ${{ github.event.pull_request.labels }} | grep -q 'patch'; then + elif echo "${{ github.event.pull_request.labels }}" | grep -q 'patch'; then RELEASE_TYPE_TAG="patch" else - RELEASE_TYPE_TAG="" + echo "::error::No tag found matching a release type." + exit 1 fi echo "Release tag: $RELEASE_TYPE_TAG" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4bb1824..5effb67 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,10 @@ name: Continuous Integration on: - # pull_request: - # paths: - # - 'src/**' - # - 'test/**' + pull_request: + paths: + - 'src/**' + - 'test/**' push: paths: - 'src/**' From 66a63190c50a47563197980ae48f3028987879fc Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 15:10:51 +0200 Subject: [PATCH 22/56] Continuous Integration change triggers --- .github/workflows/ci.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5effb67..3d1d8ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,12 @@ name: Continuous Integration on: pull_request: + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled paths: - 'src/**' - 'test/**' @@ -9,6 +15,8 @@ on: paths: - 'src/**' - 'test/**' + branches: + - master jobs: test: From 415dfe1fc7af1545982acfed3c0750ef076dd11d Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 15:18:40 +0200 Subject: [PATCH 23/56] Debug message --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d1d8ee..dc4a9b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,10 @@ jobs: runs-on: ubuntu-latest steps: + - run: | + echo "${{github.event.sender}}" + echo "${{github.event}}" + - name: Checkout repository uses: actions/checkout@v4 From 523e0a8c8dda220abb8654f58ff42bf4f6cb6383 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 15:21:16 +0200 Subject: [PATCH 24/56] Test changes to /src (#38) --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index b78f2a4..5e6bab9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,7 +13,7 @@ export default class MyPlugin extends Plugin { } onunload() { - // TEST CHANGES FOR RELEASE WORKFLOW 2 + // TEST CHANGES FOR RELEASE WORKFLOW 3 } async loadSettings() { From b1d675bbb119ce67145159354cc4a49401c0c5bb Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 15:27:14 +0200 Subject: [PATCH 25/56] Change readout labels method for Continuous Delivery --- .github/workflows/cd.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f5cd863..9f6fc3b 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -22,14 +22,14 @@ jobs: - name: Process Pull Request id: process-pr run: | - # TODO: From pull request get the tag to set the release type - echo "::debug::Labels: ${{ github.event.pull_request.labels }}" + LABELS=$(jq -r '.pull_request.labels[].name' "$GITHUB_EVENT_PATH") + echo "::debug::Labels: $LABELS" - if echo "${{ github.event.pull_request.labels }}" | grep -q 'major'; then + if echo "$LABELS" | grep -q 'major'; then RELEASE_TYPE_TAG="major" - elif echo "${{ github.event.pull_request.labels }}" | grep -q 'minor'; then + elif echo "$LABELS" | grep -q 'minor'; then RELEASE_TYPE_TAG="minor" - elif echo "${{ github.event.pull_request.labels }}" | grep -q 'patch'; then + elif echo "$LABELS" | grep -q 'patch'; then RELEASE_TYPE_TAG="patch" else echo "::error::No tag found matching a release type." From bb71039b6c8271929cdf9837702c3d6f6c8e6e16 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 15:36:42 +0200 Subject: [PATCH 26/56] Add permission contents write to Continuous Delivery --- .github/workflows/cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9f6fc3b..e311818 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -10,9 +10,9 @@ jobs: release: runs-on: ubuntu-latest if: github.event.pull_request.merged == true - # permissions: + permissions: # pull-requests: write - # contents: write + contents: write steps: - name: Checkout From 97901c3a19504e9a76198fde3916854d56a83902 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 15:40:18 +0200 Subject: [PATCH 27/56] Test changes to /src (#41) --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 5e6bab9..b2fb754 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,7 +13,7 @@ export default class MyPlugin extends Plugin { } onunload() { - // TEST CHANGES FOR RELEASE WORKFLOW 3 + // TEST CHANGES FOR RELEASE WORKFLOW 4 } async loadSettings() { From a2e5575e3f7a938aecfd75f371a6bd59fa4d62db Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 15:44:22 +0200 Subject: [PATCH 28/56] Try reduced permissions on Continuous Integration --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc4a9b7..5691dd5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -107,8 +107,8 @@ jobs: name: Version Bump runs-on: ubuntu-latest if: github.event_name == 'pull_request' - permissions: - pull-requests: write + # permissions: + # pull-requests: write steps: - name: Checkout From f3b78246250d30b555857bff7fe19273a3e3da06 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 16:11:13 +0200 Subject: [PATCH 29/56] Implement remove release type tags --- .github/workflows/cd.yml | 1 - .github/workflows/ci.yml | 4 ---- .github/workflows/release.yml | 24 +++++++++++++++++------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e311818..01b9b11 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,7 +11,6 @@ jobs: runs-on: ubuntu-latest if: github.event.pull_request.merged == true permissions: - # pull-requests: write contents: write steps: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5691dd5..dfcb634 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,10 +47,6 @@ jobs: runs-on: ubuntu-latest steps: - - run: | - echo "${{github.event.sender}}" - echo "${{github.event}}" - - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index abdde31..23cb45a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,15 +74,10 @@ jobs: elif git tag --list | grep -q 'patch'; then RELEASE_TYPE_TAG="patch" else - RELEASE_TYPE_TAG="" - fi - - if [ -z "$RELEASE_TYPE_TAG" ]; then echo "::error::No tag found matching a release type." exit 1 fi - echo "Release tag: $RELEASE_TYPE_TAG" echo "release_type=$RELEASE_TYPE_TAG" >> $GITHUB_OUTPUT fi @@ -159,5 +154,20 @@ jobs: - name: Remove release type tags run: | - echo "TODO" - exit 1 \ No newline at end of file + FAILED=0 + + for tag in major minor patch; do + if git tag -l "$tag" >/dev/null; then + echo "Deleting remote tag: $tag" + if git push --delete origin $tag; then + echo "::debug::Deleted remote tag $tag" + else + echo "::error::Failed to delete remote tag $tag" + FAILED=1 + fi + else + echo "::debug::No $tag tag found locally." + fi + done + + exit $FAILED From b0332606cec40869bd5b10c705a7396caa2e487c Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 16:17:54 +0200 Subject: [PATCH 30/56] Test changes to /src (#42) * Test changes to /src * Make first release automated possible --- .github/workflows/release.yml | 34 +++++++++++++++++----------------- src/main.ts | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23cb45a..e5b86c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -56,8 +56,7 @@ jobs: LAST_VERSION_TAG=$(git tag --list | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | grep -v '-' | sort -V | tail -n1 || echo "") if [ -z "$LAST_VERSION_TAG" ]; then - echo "::error::No previous tag found. First release has to be a manual release." - exit 1 + echo "No previous tag found. Assuming first release." else echo "Last tag: $LAST_VERSION_TAG" if git diff --quiet "$LAST_VERSION_TAG"..HEAD -- src/; then @@ -65,23 +64,24 @@ jobs: exit 0 else echo "::debug::Changes detected in /src since last release." + fi + fi - # Find the highest release type - if git tag --list | grep -q 'major'; then - RELEASE_TYPE_TAG="major" - elif git tag --list | grep -q 'minor'; then - RELEASE_TYPE_TAG="minor" - elif git tag --list | grep -q 'patch'; then - RELEASE_TYPE_TAG="patch" - else - echo "::error::No tag found matching a release type." - exit 1 - fi + # Find the highest release type + if git tag --list | grep -q 'major'; then + RELEASE_TYPE_TAG="major" + elif git tag --list | grep -q 'minor'; then + RELEASE_TYPE_TAG="minor" + elif git tag --list | grep -q 'patch'; then + RELEASE_TYPE_TAG="patch" + else + echo "::error::No tag found matching a release type." + exit 1 + fi - echo "Release tag: $RELEASE_TYPE_TAG" - echo "release_type=$RELEASE_TYPE_TAG" >> $GITHUB_OUTPUT - fi - fi + echo "Release tag: $RELEASE_TYPE_TAG" + echo "release_type=$RELEASE_TYPE_TAG" >> $GITHUB_OUTPUT + - name: Install Dependencies run: npm install diff --git a/src/main.ts b/src/main.ts index b2fb754..2d4628a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,7 +13,7 @@ export default class MyPlugin extends Plugin { } onunload() { - // TEST CHANGES FOR RELEASE WORKFLOW 4 + // TEST CHANGES FOR RELEASE WORKFLOW 5 } async loadSettings() { From 72e09de90f49162b33cf27070ee78a18df565c78 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:19:24 +0000 Subject: [PATCH 31/56] Apply version 1.0.0 --- manifest.json | 2 +- package.json | 4 ++-- versions.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index c4e0825..e0af448 100644 --- a/manifest.json +++ b/manifest.json @@ -7,5 +7,5 @@ "authorUrl": "https://github.com/4Source", "isDesktopOnly": false, "fundingUrl": "https://www.buymeacoffee.com/4Source", - "version": "0.0.1" + "version": "1.0.0" } \ No newline at end of file diff --git a/package.json b/package.json index c9e5dd4..7404c36 100644 --- a/package.json +++ b/package.json @@ -35,5 +35,5 @@ "tslib": "2.4.0", "typescript": "^5.9.2" }, - "version": "0.0.1" -} + "version": "1.0.0" +} \ No newline at end of file diff --git a/versions.json b/versions.json index b5fbc7b..5842672 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "0.0.1": "0.15.0" + "1.0.0": "0.15.0" } \ No newline at end of file From da30726b0e485087f5b1332d7eea200dccf91ab0 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 16:29:35 +0200 Subject: [PATCH 32/56] Improve release --- .github/workflows/ci.yml | 2 -- .github/workflows/release.yml | 9 ++------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dfcb634..0d8beaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,8 +103,6 @@ jobs: name: Version Bump runs-on: ubuntu-latest if: github.event_name == 'pull_request' - # permissions: - # pull-requests: write steps: - name: Checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e5b86c4..3dd98a5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -96,7 +96,6 @@ jobs: version_increase: ${{ steps.changes.outputs.release_type }} tag_prefix: '' dry_run: true - # TODO: Changes necessary to accept ref (branch) - name: Configure git run: | @@ -143,14 +142,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - FILES="main.js manifest.json" - if [ -f styles.css ]; then - FILES="$FILES styles.css" - fi gh release create "${{ steps.version-bump.outputs.new_version }}" \ --title "${{ steps.version-bump.outputs.new_version }}" \ - --draft \ - ${{ steps.build-plugin.outputs.release_files }} + --generate-notes \ + "${{ steps.build-plugin.outputs.release_files }}" - name: Remove release type tags run: | From a89f23bd42e070ded2bf309f6536b10215cd1bfd Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 16:34:04 +0200 Subject: [PATCH 33/56] Test changes to /src (#43) --- src/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 2d4628a..804760e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,7 +13,7 @@ export default class MyPlugin extends Plugin { } onunload() { - // TEST CHANGES FOR RELEASE WORKFLOW 5 + // TEST CHANGES FOR RELEASE WORKFLOW 6 } async loadSettings() { From 6b4a2e4c57a4d44a3673ac51f0b5ad4088cfb86d Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:35:04 +0000 Subject: [PATCH 34/56] Apply version 1.0.1 --- manifest.json | 2 +- package-lock.json | 4 ++-- package.json | 2 +- versions.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifest.json b/manifest.json index e0af448..bdd44da 100644 --- a/manifest.json +++ b/manifest.json @@ -7,5 +7,5 @@ "authorUrl": "https://github.com/4Source", "isDesktopOnly": false, "fundingUrl": "https://www.buymeacoffee.com/4Source", - "version": "1.0.0" + "version": "1.0.1" } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4e7b42e..e6ded26 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-plugin-template", - "version": "0.0.1", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "obsidian-plugin-template", - "version": "0.0.1", + "version": "1.0.0", "license": "MIT", "devDependencies": { "@eslint/eslintrc": "^3.3.1", diff --git a/package.json b/package.json index 7404c36..5259985 100644 --- a/package.json +++ b/package.json @@ -35,5 +35,5 @@ "tslib": "2.4.0", "typescript": "^5.9.2" }, - "version": "1.0.0" + "version": "1.0.1" } \ No newline at end of file diff --git a/versions.json b/versions.json index 5842672..29588ba 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "1.0.0": "0.15.0" + "1.0.1": "0.15.0" } \ No newline at end of file From d30764f67e8a13550b16bb2330cd20eba824ae03 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 16:38:52 +0200 Subject: [PATCH 35/56] Use Env Var to pass files to release --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3dd98a5..622f732 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -142,10 +142,11 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + FILES="${{ steps.build-plugin.outputs.release_files }}" gh release create "${{ steps.version-bump.outputs.new_version }}" \ --title "${{ steps.version-bump.outputs.new_version }}" \ --generate-notes \ - "${{ steps.build-plugin.outputs.release_files }}" + $FILES - name: Remove release type tags run: | From 16da8ff5891068990c1455686981786c59c237a8 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 14:39:48 +0000 Subject: [PATCH 36/56] Apply version 1.0.1 --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index e6ded26..821f15a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "obsidian-plugin-template", - "version": "1.0.0", + "version": "1.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "obsidian-plugin-template", - "version": "1.0.0", + "version": "1.0.1", "license": "MIT", "devDependencies": { "@eslint/eslintrc": "^3.3.1", From 40e90e08d366cc280f8ebbe159cb6858dccfae17 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 16:43:32 +0200 Subject: [PATCH 37/56] Fix checking for local tag --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 622f732..27ea287 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -153,7 +153,7 @@ jobs: FAILED=0 for tag in major minor patch; do - if git tag -l "$tag" >/dev/null; then + if [ -n "$(git tag -l "$tag")" ]; then echo "Deleting remote tag: $tag" if git push --delete origin $tag; then echo "::debug::Deleted remote tag $tag" From 2fe40205840ccf3e4e70837e777bb01eecbb9974 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 16:56:31 +0200 Subject: [PATCH 38/56] Fix Skipping if no changes --- .github/workflows/release.yml | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 27ea287..c90459c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,6 +28,7 @@ jobs: steps: - name: Checkout id: checkout + # TODO: Have to use this commit because fetch-tags is not working in main till this is merged to main uses: actions/checkout@0548471950d86b19eae6c063105707c831fb5c03 with: ref: ${{ github.event.ref }} @@ -41,14 +42,7 @@ jobs: - name: Check changes since last release id: changes run: | - if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - echo "Requested release type: ${{ inputs.selected_release_type }}" - - if [ "${{ inputs.selected_release_type }}" != "auto" ]; then - echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT - exit 0 - fi - fi + echo "skip=false" >> $GITHUB_OUTPUT echo "::debug::Tags: git tag --list" @@ -61,12 +55,22 @@ jobs: echo "Last tag: $LAST_VERSION_TAG" if git diff --quiet "$LAST_VERSION_TAG"..HEAD -- src/; then echo "No changes in /src since last release." + echo "skip=true" >> $GITHUB_OUTPUT exit 0 else echo "::debug::Changes detected in /src since last release." fi fi + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + echo "Requested release type: ${{ inputs.selected_release_type }}" + + if [ "${{ inputs.selected_release_type }}" != "auto" ]; then + echo "release_type=${{ inputs.selected_release_type }}" >> $GITHUB_OUTPUT + exit 0 + fi + fi + # Find the highest release type if git tag --list | grep -q 'major'; then RELEASE_TYPE_TAG="major" @@ -84,9 +88,11 @@ jobs: - name: Install Dependencies + if: ${{ steps.changes.outputs.skip == 'false' }} run: npm install - name: Bump version + if: ${{ steps.changes.outputs.skip == 'false' }} id: version-bump uses: 4Source/version-control-action@v1 with: @@ -98,26 +104,31 @@ jobs: dry_run: true - name: Configure git + if: ${{ steps.changes.outputs.skip == 'false' }} run: | git config --global user.name "4Source" git config --global user.email "38220764+4Source@users.noreply.github.com" - name: Change version in files + if: ${{ steps.changes.outputs.skip == 'false' }} run: | npm run version -- --new_version=${{ steps.version-bump.outputs.new_version }} git add manifest.json versions.json package.json - name: Commit and push changes + if: ${{ steps.changes.outputs.skip == 'false' }} run: | git commit -a -m "Apply version ${{ steps.version-bump.outputs.new_version }}" git push - name: Push version tag + if: ${{ steps.changes.outputs.skip == 'false' }} run: | git tag -a ${{ steps.version-bump.outputs.new_version }} -m "${{ steps.version-bump.outputs.new_version }}" git push origin ${{ steps.version-bump.outputs.new_version }} - name: Build plugin + if: ${{ steps.changes.outputs.skip == 'false' }} id: build-plugin run: | npm run build @@ -139,6 +150,7 @@ jobs: echo "release_files=$FILES" >> $GITHUB_OUTPUT - name: Create release + if: ${{ steps.changes.outputs.skip == 'false' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -149,6 +161,7 @@ jobs: $FILES - name: Remove release type tags + if: ${{ steps.changes.outputs.skip == 'false' }} run: | FAILED=0 From ef05739f66c44021cfac7509e71097cf726b851e Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:07:36 +0200 Subject: [PATCH 39/56] Allow forced release --- .github/workflows/release.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c90459c..cf0beec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,10 @@ on: - patch - minor - major + force_release: + description: "Forces a release even without changes except with type auto" + type: boolean + default: false schedule: # Schedule automatic release every Wednesday @@ -54,8 +58,17 @@ jobs: else echo "Last tag: $LAST_VERSION_TAG" if git diff --quiet "$LAST_VERSION_TAG"..HEAD -- src/; then - echo "No changes in /src since last release." - echo "skip=true" >> $GITHUB_OUTPUT + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + echo "::warning::No changes in /src since last release." + if ${{ inputs.force_release }} then + echo "::warning::Forced release." + else + echo "skip=true" >> $GITHUB_OUTPUT + fi + elif [ "${{ github.event_name }}" == "schedule" ]; then + echo "No changes in /src since last release." + echo "skip=true" >> $GITHUB_OUTPUT + fi exit 0 else echo "::debug::Changes detected in /src since last release." @@ -161,7 +174,6 @@ jobs: $FILES - name: Remove release type tags - if: ${{ steps.changes.outputs.skip == 'false' }} run: | FAILED=0 From 8f8b4426899bf31db2c92de3996df01e9fdb74a6 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:15:04 +0200 Subject: [PATCH 40/56] Force not allowed with type auto --- .github/workflows/release.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cf0beec..4216d44 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ on: - minor - major force_release: - description: "Forces a release even without changes except with type auto" + description: "Forces a release even without changes (not auto)" type: boolean default: false @@ -60,8 +60,11 @@ jobs: if git diff --quiet "$LAST_VERSION_TAG"..HEAD -- src/; then if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then echo "::warning::No changes in /src since last release." - if ${{ inputs.force_release }} then + if ${{ inputs.force_release }} && [ "${{ inputs.selected_release_type }}" != "auto" ]; then echo "::warning::Forced release." + elif ${{ inputs.force_release }} && [ "${{ inputs.selected_release_type }}" == "auto" ]; then + echo "::error::Forces is not possible with release type auto." + echo "skip=true" >> $GITHUB_OUTPUT else echo "skip=true" >> $GITHUB_OUTPUT fi From feb0ee38c680b63bd7481a1d069ce108fecf6778 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:16:39 +0200 Subject: [PATCH 41/56] exit 1 on force release with auto --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4216d44..47b7402 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -64,7 +64,7 @@ jobs: echo "::warning::Forced release." elif ${{ inputs.force_release }} && [ "${{ inputs.selected_release_type }}" == "auto" ]; then echo "::error::Forces is not possible with release type auto." - echo "skip=true" >> $GITHUB_OUTPUT + exit 1 else echo "skip=true" >> $GITHUB_OUTPUT fi From 0e45d91d54b9bd97f428086fe2f96b293f6c9e9a Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:19:18 +0200 Subject: [PATCH 42/56] exit 1 on manual release with no changes --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 47b7402..c0f8ae3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,7 +66,7 @@ jobs: echo "::error::Forces is not possible with release type auto." exit 1 else - echo "skip=true" >> $GITHUB_OUTPUT + exit 1 fi elif [ "${{ github.event_name }}" == "schedule" ]; then echo "No changes in /src since last release." From 77294a563198eb29117b64a827670ce2bf7bc476 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:23:35 +0200 Subject: [PATCH 43/56] remove exit 0 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c0f8ae3..d4e2879 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,8 +71,8 @@ jobs: elif [ "${{ github.event_name }}" == "schedule" ]; then echo "No changes in /src since last release." echo "skip=true" >> $GITHUB_OUTPUT + exit 0 fi - exit 0 else echo "::debug::Changes detected in /src since last release." fi From a266e52263828bb25d6acaf8a791b8f32f1cc29c Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 15:24:09 +0000 Subject: [PATCH 44/56] Apply version 1.1.0 --- manifest.json | 2 +- package.json | 2 +- versions.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.json b/manifest.json index bdd44da..d15e430 100644 --- a/manifest.json +++ b/manifest.json @@ -7,5 +7,5 @@ "authorUrl": "https://github.com/4Source", "isDesktopOnly": false, "fundingUrl": "https://www.buymeacoffee.com/4Source", - "version": "1.0.1" + "version": "1.1.0" } \ No newline at end of file diff --git a/package.json b/package.json index 5259985..fa57c1b 100644 --- a/package.json +++ b/package.json @@ -35,5 +35,5 @@ "tslib": "2.4.0", "typescript": "^5.9.2" }, - "version": "1.0.1" + "version": "1.1.0" } \ No newline at end of file diff --git a/versions.json b/versions.json index 29588ba..26b14ba 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,3 @@ { - "1.0.1": "0.15.0" + "1.1.0": "0.15.0" } \ No newline at end of file From d38cb9584a4e08b22258c4c099a2a40ddc26be8f Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:26:29 +0200 Subject: [PATCH 45/56] reactivated on master Continuous Delivery --- .github/workflows/cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 01b9b11..3546986 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -3,8 +3,8 @@ on: pull_request: types: - closed - # branches: - # - master + branches: + - master jobs: release: From 18a9d1b72ee842a0db4c33a94c4d110308fc85c9 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:39:31 +0200 Subject: [PATCH 46/56] Start of beta releases --- .github/workflows/ci.yml | 163 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 162 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d8beaa..154900f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,4 +116,165 @@ jobs: repository: ${{ github.event.repository.name }} pr_number: ${{ github.event.number }} tag_prefix: '' - dry_run: true \ No newline at end of file + dry_run: true + + beta-release: + name: Beta releases for pull requests + runs-on: ubuntu-latest + needs: + - test + - build + - version + # TODO: Beta releases are currently disabled + if: github.event_name == 'pull_request' && false + + permissions: + pull-requests: write + contents: write + + steps: + - name: Checkout + id: checkout + # TODO: Have to use this commit because fetch-tags is not working in main till this is merged to main + uses: actions/checkout@0548471950d86b19eae6c063105707c831fb5c03 + with: + ref: ${{ github.event.ref }} + fetch-tags: true + + - name: Use Node.js 18.x + uses: actions/setup-node@v4 + with: + node-version: 18.x + + - name: Check changes since last release + id: changes + run: | + echo "skip=false" >> $GITHUB_OUTPUT + + echo "::debug::Tags: git tag --list" + + # Find the latest semver tag + LAST_VERSION_TAG=$(git tag --list | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | grep -v '-' | sort -V | tail -n1 || echo "") + + if [ -z "$LAST_VERSION_TAG" ]; then + echo "No previous tag found. Assuming first release." + else + echo "Last tag: $LAST_VERSION_TAG" + if git diff --quiet "$LAST_VERSION_TAG"..HEAD -- src/; then + echo "No changes in /src since last release." + echo "skip=true" >> $GITHUB_OUTPUT + exit 0 + else + echo "::debug::Changes detected in /src since last release." + fi + fi + + # Find the highest release type + if git tag --list | grep -q 'major'; then + RELEASE_TYPE_TAG="major" + elif git tag --list | grep -q 'minor'; then + RELEASE_TYPE_TAG="minor" + elif git tag --list | grep -q 'patch'; then + RELEASE_TYPE_TAG="patch" + else + echo "::error::No tag found matching a release type." + exit 1 + fi + + echo "Release tag: $RELEASE_TYPE_TAG" + echo "release_type=$RELEASE_TYPE_TAG" >> $GITHUB_OUTPUT + + + - name: Install Dependencies + if: ${{ steps.changes.outputs.skip == 'false' }} + run: npm install + + - name: Bump version + if: ${{ steps.changes.outputs.skip == 'false' }} + id: version-bump + uses: 4Source/version-control-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + owner: ${{ github.repository_owner }} + repository: ${{ github.event.repository.name }} + version_increase: ${{ steps.changes.outputs.release_type }} + tag_prefix: '' + dry_run: true + # TODO: Is beta + beta string + + - name: Configure git + if: ${{ steps.changes.outputs.skip == 'false' }} + run: | + git config --global user.name "4Source" + git config --global user.email "38220764+4Source@users.noreply.github.com" + + - name: Change version in files + if: ${{ steps.changes.outputs.skip == 'false' }} + run: | + npm run version -- --new_version=${{ steps.version-bump.outputs.new_version }} + git add manifest.json versions.json package.json + + - name: Commit and push changes + if: ${{ steps.changes.outputs.skip == 'false' }} + run: | + git commit -a -m "Apply version ${{ steps.version-bump.outputs.new_version }}" + git push + + - name: Push version tag + if: ${{ steps.changes.outputs.skip == 'false' }} + run: | + git tag -a ${{ steps.version-bump.outputs.new_version }} -m "${{ steps.version-bump.outputs.new_version }}" + git push origin ${{ steps.version-bump.outputs.new_version }} + + - name: Build plugin + if: ${{ steps.changes.outputs.skip == 'false' }} + id: build-plugin + run: | + npm run build + + if [ ! -f main.js ]; then + echo "Error: main.js is missing." + exit 1 + fi + + if [ ! -f manifest.json ]; then + echo "Error: manifest.json is missing." + exit 1 + fi + + FILES="main.js manifest.json" + if [ -f styles.css ]; then + FILES="$FILES styles.css" + fi + echo "release_files=$FILES" >> $GITHUB_OUTPUT + + - name: Create release + if: ${{ steps.changes.outputs.skip == 'false' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + FILES="${{ steps.build-plugin.outputs.release_files }}" + gh release create "${{ steps.version-bump.outputs.new_version }}" \ + --title "${{ steps.version-bump.outputs.new_version }}" \ + --generate-notes \ + $FILES + + - name: Remove release type tags + run: | + FAILED=0 + + for tag in major minor patch; do + if [ -n "$(git tag -l "$tag")" ]; then + echo "Deleting remote tag: $tag" + if git push --delete origin $tag; then + echo "::debug::Deleted remote tag $tag" + else + echo "::error::Failed to delete remote tag $tag" + FAILED=1 + fi + else + echo "::debug::No $tag tag found locally." + fi + done + + exit $FAILED From cf9d9bf154ae9b48996ba3d4d173c46a79929431 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Wed, 17 Sep 2025 17:30:35 +0200 Subject: [PATCH 47/56] Fix force release in case of schedule --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4e2879..cb4752a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -60,9 +60,10 @@ jobs: if git diff --quiet "$LAST_VERSION_TAG"..HEAD -- src/; then if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then echo "::warning::No changes in /src since last release." - if ${{ inputs.force_release }} && [ "${{ inputs.selected_release_type }}" != "auto" ]; then + FORCE_RELEASE="${{ github.event.inputs.force_release || false }}" + if $FORCE_RELEASE && [ "${{ inputs.selected_release_type }}" != "auto" ]; then echo "::warning::Forced release." - elif ${{ inputs.force_release }} && [ "${{ inputs.selected_release_type }}" == "auto" ]; then + elif $FORCE_RELEASE && [ "${{ inputs.selected_release_type }}" == "auto" ]; then echo "::error::Forces is not possible with release type auto." exit 1 else From 87e808ac9f131f1a10a5cacdc04a84219642dfdc Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Wed, 17 Sep 2025 17:33:52 +0200 Subject: [PATCH 48/56] Change cron for testing --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cb4752a..705e746 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,8 @@ on: schedule: # Schedule automatic release every Wednesday - - cron: '0 0 * * 3' + # - cron: '0 0 * * 3' + - cron: '45 * * * *' jobs: From f4139f3cc4ffc5a331d2ea34553c6b0c019860ee Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Wed, 17 Sep 2025 18:27:42 +0200 Subject: [PATCH 49/56] Revert "Change cron for testing" This reverts commit 87e808ac9f131f1a10a5cacdc04a84219642dfdc. --- .github/workflows/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 705e746..cb4752a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,8 +19,7 @@ on: schedule: # Schedule automatic release every Wednesday - # - cron: '0 0 * * 3' - - cron: '45 * * * *' + - cron: '0 0 * * 3' jobs: From 149300bae2da714789684c3f4d8af8865ac951fe Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Thu, 6 Nov 2025 08:38:40 +0100 Subject: [PATCH 50/56] Update eslint.config.mjs --- eslint.config.mjs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 563dd65..1c7ca88 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -134,6 +134,18 @@ export default defineConfig([ ignorePattern: 'TODO|HACK|BUG|TEST', applyDefaultIgnorePatterns: false, }], + + '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/array-type': ['error', { + default: 'generic' + }], + '@typescript-eslint/ban-ts-comment': ['error', { + minimumDescriptionLength: 10, + 'ts-check': false, + 'ts-expect-error': 'allow-with-description', + 'ts-ignore': false, + 'ts-nocheck': false, + }], }, }, -]); \ No newline at end of file +]); From c86efb8cb64bf703ad5315845d01928e5c2c4af9 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Tue, 3 Mar 2026 12:41:32 +0100 Subject: [PATCH 51/56] Update git configuration to GitHub Actions bot --- .github/workflows/cd.yml | 4 ++-- .github/workflows/ci.yml | 4 ++-- .github/workflows/release.yml | 4 ++-- README.md | 6 ------ 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 3546986..d90f570 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -40,8 +40,8 @@ jobs: - name: Configure git run: | - git config --global user.name "4Source" - git config --global user.email "38220764+4Source@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - name: Create or Update release type tag run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 154900f..0d98c3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -205,8 +205,8 @@ jobs: - name: Configure git if: ${{ steps.changes.outputs.skip == 'false' }} run: | - git config --global user.name "4Source" - git config --global user.email "38220764+4Source@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - name: Change version in files if: ${{ steps.changes.outputs.skip == 'false' }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cb4752a..5d8cbc9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -123,8 +123,8 @@ jobs: - name: Configure git if: ${{ steps.changes.outputs.skip == 'false' }} run: | - git config --global user.name "4Source" - git config --global user.email "38220764+4Source@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" - name: Change version in files if: ${{ steps.changes.outputs.skip == 'false' }} diff --git a/README.md b/README.md index a27ef53..569e301 100644 --- a/README.md +++ b/README.md @@ -29,12 +29,6 @@ This is a template repository for [Obsidian](https://obsidian.md) plugins. - minAppVersion (optional) - isDesktopOnly (optional) ### [LICENSE](LICENSE) (optional) -### [.github/workflows/cd.yml](.github/workflows/cd.yml) -versioning > Configure git -``` -git config --global user.name "YOUR-USER" -git config --global user.email "YOUR-EMAIL" -``` ### [bug_report.yaml](.github/ISSUE_TEMPLATE/bug_report.yaml) Plugin Version > Description: The Plugin where to look for the version ### [CONTRIBUTING.md](.github/CONTRIBUTING.md) From 1c4f9deff1450fe0ecf10cf3400dd124dfaae045 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Wed, 11 Mar 2026 00:49:48 +0100 Subject: [PATCH 52/56] Fix format + typos --- .github/pull_request_template.md | 2 +- .github/workflows/cd.yml | 1 + .github/workflows/release.yml | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index c1aae24..95af9c6 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -20,5 +20,5 @@ Fixes # - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation -- [ ] I have tested my changes in Obsidian and describte how I tested in [Tests](#tests) +- [ ] I have tested my changes in Obsidian and describe how I tested in [Tests](#tests) - [ ] My code fixes the feature discussed in [Related Issues](#related-issues) if not or not fully describe what is missing in [Missing changes](#missing-changes) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d90f570..2dfd983 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,4 +1,5 @@ name: Continuous Delivery + on: pull_request: types: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d8cbc9..c83c0c9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,5 @@ name: Release new plugin version + on: workflow_dispatch: inputs: @@ -21,7 +22,6 @@ on: # Schedule automatic release every Wednesday - cron: '0 0 * * 3' - jobs: release: runs-on: ubuntu-latest From 7f539eeb97f28a40d9b6b8b742b3d7a7aecb4186 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Fri, 13 Mar 2026 16:04:55 +0100 Subject: [PATCH 53/56] Add Sample command and integrate command registration --- src/commands/Sample.ts | 12 ++++++++++++ src/commands/index.ts | 8 ++++++++ src/main.ts | 4 ++++ 3 files changed, 24 insertions(+) create mode 100644 src/commands/Sample.ts create mode 100644 src/commands/index.ts diff --git a/src/commands/Sample.ts b/src/commands/Sample.ts new file mode 100644 index 0000000..0515bd9 --- /dev/null +++ b/src/commands/Sample.ts @@ -0,0 +1,12 @@ +import { Command } from "obsidian"; +import CurrentPlugin from "../main"; + +export default function (plugin: CurrentPlugin): Command { + return { + id: "sample", + name: "Sample", + callback: () => { + console.log(plugin); + }, + }; +} \ No newline at end of file diff --git a/src/commands/index.ts b/src/commands/index.ts new file mode 100644 index 0000000..6110499 --- /dev/null +++ b/src/commands/index.ts @@ -0,0 +1,8 @@ +import CurrentPlugin from "../main"; +import Sample from "./Sample"; + +export async function addAllCommands(plugin: CurrentPlugin) { + // TODO: Dynamically import all files in the commands folder during bundling time + + plugin.addCommand(Sample(plugin)); +} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 804760e..2134251 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,7 @@ import { Plugin } from 'obsidian'; import { DEFAULT_SETTINGS, Settings } from './settings/SettingsInterface'; import { MyPluginSettingTab } from './settings/SettingsTab'; +import { addAllCommands } from './commands'; export default class MyPlugin extends Plugin { settings: Settings; @@ -10,6 +11,9 @@ export default class MyPlugin extends Plugin { // This adds a settings tab so the user can configure various aspects of the plugin this.addSettingTab(new MyPluginSettingTab(this.app, this)); + + // Add all commands registered + addAllCommands(this); } onunload() { From 8eb16f4fe459aa345a332e8df521e55556d23795 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Fri, 13 Mar 2026 16:44:22 +0100 Subject: [PATCH 54/56] Fix missing package-lock update of version-change.mjs --- test/version.test.ts | 2 ++ version-change.mjs | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/test/version.test.ts b/test/version.test.ts index 2e293f1..88ec82f 100644 --- a/test/version.test.ts +++ b/test/version.test.ts @@ -1,9 +1,11 @@ import { version as manifestVersion, minAppVersion as manifestMinAppVersion } from '../manifest.json'; import { version as packageVersion } from '../package.json'; +import { version as packageLockVersion } from '../package.json'; import versions from '../versions.json'; test('Versions matching', () => { expect(manifestVersion).toBe(packageVersion); + expect(manifestVersion).toBe(packageLockVersion); expect(Object.keys(versions).find(value => value === manifestVersion)).toBe(manifestVersion); expect(Object.entries(versions).find(value => value[0] === manifestVersion)?.[1]).toBe(manifestMinAppVersion); }); \ No newline at end of file diff --git a/version-change.mjs b/version-change.mjs index c883f31..3307364 100644 --- a/version-change.mjs +++ b/version-change.mjs @@ -1,3 +1,4 @@ +import { execSync } from 'child_process'; import { readFileSync, writeFileSync } from 'fs'; import { valid } from 'semver'; @@ -10,14 +11,14 @@ if (!targetVersion) { throw Error('Param --new_version is empty!'); } if (!valid(targetVersion)) { - throw Error('New version is invalid!'); + throw Error('New version is invalid!') } // read minAppVersion from manifest.json let manifestFile = JSON.parse(readFileSync('manifest.json', 'utf8')); const { minAppVersion } = manifestFile; if (!minAppVersion || minAppVersion === '') { - throw Error('Missing minAppVersion in "manifest.json"'); + throw Error(`Missing minAppVersion in 'manifest.json'`); } // update version to target version @@ -29,7 +30,14 @@ let packageFile = JSON.parse(readFileSync('package.json', 'utf8')); packageFile.version = targetVersion; writeFileSync('package.json', JSON.stringify(packageFile, null, '\t')); -// read versions file +// update version in package-lock +try { + execSync('npm install', { stdio: 'inherit' }); +} catch (error) { + throw Error('npm installed failed: ' + error); +} + +// read versions file let versionsFile = JSON.parse(readFileSync('versions.json', 'utf8')); let keys = Object.keys(versionsFile); From b6592447529355c87430bfa187c09d02b15c8fdb Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Fri, 13 Mar 2026 17:28:10 +0100 Subject: [PATCH 55/56] Fix condition for removing release type tags in release workflow --- .github/workflows/release.yml | 40 +++++++++++++++++------------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c83c0c9..3d58769 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,12 @@ name: Release new plugin version -on: +on: workflow_dispatch: - inputs: + inputs: selected_release_type: description: "Choose version update type" required: true - default: 'auto' + default: "auto" type: choice options: - auto @@ -17,19 +17,19 @@ on: description: "Forces a release even without changes (not auto)" type: boolean default: false - + schedule: # Schedule automatic release every Wednesday - - cron: '0 0 * * 3' + - cron: "0 0 * * 3" jobs: release: runs-on: ubuntu-latest - permissions: - pull-requests: write - contents: write + permissions: + pull-requests: write + contents: write - steps: + steps: - name: Checkout id: checkout # TODO: Have to use this commit because fetch-tags is not working in main till this is merged to main @@ -42,7 +42,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: 18.x - + - name: Check changes since last release id: changes run: | @@ -102,8 +102,7 @@ jobs: echo "Release tag: $RELEASE_TYPE_TAG" echo "release_type=$RELEASE_TYPE_TAG" >> $GITHUB_OUTPUT - - + - name: Install Dependencies if: ${{ steps.changes.outputs.skip == 'false' }} run: npm install @@ -112,12 +111,12 @@ jobs: if: ${{ steps.changes.outputs.skip == 'false' }} id: version-bump uses: 4Source/version-control-action@v1 - with: + with: github_token: ${{ secrets.GITHUB_TOKEN }} owner: ${{ github.repository_owner }} - repository: ${{ github.event.repository.name }} + repository: ${{ github.event.repository.name }} version_increase: ${{ steps.changes.outputs.release_type }} - tag_prefix: '' + tag_prefix: "" dry_run: true - name: Configure git @@ -128,16 +127,16 @@ jobs: - name: Change version in files if: ${{ steps.changes.outputs.skip == 'false' }} - run: | + run: | npm run version -- --new_version=${{ steps.version-bump.outputs.new_version }} git add manifest.json versions.json package.json - + - name: Commit and push changes if: ${{ steps.changes.outputs.skip == 'false' }} run: | git commit -a -m "Apply version ${{ steps.version-bump.outputs.new_version }}" git push - + - name: Push version tag if: ${{ steps.changes.outputs.skip == 'false' }} run: | @@ -165,7 +164,7 @@ jobs: FILES="$FILES styles.css" fi echo "release_files=$FILES" >> $GITHUB_OUTPUT - + - name: Create release if: ${{ steps.changes.outputs.skip == 'false' }} env: @@ -176,8 +175,9 @@ jobs: --title "${{ steps.version-bump.outputs.new_version }}" \ --generate-notes \ $FILES - + - name: Remove release type tags + if: ${{ steps.changes.outputs.skip == 'false'}} run: | FAILED=0 From 70f5831d59449ce137d3ed0bb3557ca9e1f63b07 Mon Sep 17 00:00:00 2001 From: 4Source <38220764+4Source@users.noreply.github.com> Date: Wed, 25 Mar 2026 08:58:04 +0100 Subject: [PATCH 56/56] Disable automatic schedule --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d58769..5e54775 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ on: schedule: # Schedule automatic release every Wednesday - - cron: "0 0 * * 3" + # - cron: "0 0 * * 3" jobs: release: