From 80670a96effc8542705a776fbae0a871226335af Mon Sep 17 00:00:00 2001 From: Rudy Gnodde Date: Sun, 22 Feb 2026 15:25:52 +0100 Subject: [PATCH] [TASK] Add github actions --- .github/FUNDING.yml | 15 ++++++++++++ .github/workflows/build.yml | 24 +++++++++++++++++++ .github/workflows/hacs.yml | 17 ++++++++++++++ .github/workflows/protectmainbranch.yml | 14 +++++++++++ .github/workflows/release.yml | 31 +++++++++++++++++++++++++ 5 files changed, 101 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/hacs.yml create mode 100644 .github/workflows/protectmainbranch.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..4ca83b8 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,15 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: rudygnodde +thanks_dev: # Replace with a single thanks.dev username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..0378d88 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,24 @@ +name: 'Validate Build' + +on: + push: + branches: + - main + pull_request: + branches: + - main + - dev + +jobs: + build: + name: Test build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + - name: Build + run: | + npm install + npm run build diff --git a/.github/workflows/hacs.yml b/.github/workflows/hacs.yml new file mode 100644 index 0000000..cb129e8 --- /dev/null +++ b/.github/workflows/hacs.yml @@ -0,0 +1,17 @@ +name: HACS Action + +on: + push: + pull_request: + schedule: + - cron: "0 0 * * *" + +jobs: + hacs: + name: HACS Action + runs-on: "ubuntu-latest" + steps: + - name: HACS Action + uses: "hacs/action@main" + with: + category: "plugin" diff --git a/.github/workflows/protectmainbranch.yml b/.github/workflows/protectmainbranch.yml new file mode 100644 index 0000000..6e78f46 --- /dev/null +++ b/.github/workflows/protectmainbranch.yml @@ -0,0 +1,14 @@ +name: 'Protect main branch' + +on: + pull_request: + +jobs: + check_origin_branch: + runs-on: ubuntu-latest + steps: + - name: Check origin branch + if: github.base_ref == 'main' && github.head_ref != 'dev' + run: | + echo "ERROR: You can only merge to main from dev." + exit 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5baeb1a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,31 @@ +name: 'Build & Publish' + +on: + release: + types: [published] + +jobs: + release: + name: Prepare release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + + # Build + - name: Build the file + run: | + npm install + npm run build + + # Upload build file to the release as an asset. + - name: Upload js to release + uses: svenstaro/upload-release-action@2.0.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: dist/multitodo.js + asset_name: multitodo.js + tag: ${{ github.ref }} + overwrite: true