From 1dd7bec7001810930f79a85bdacb159a338f532b Mon Sep 17 00:00:00 2001 From: Denys Dovhan Date: Mon, 21 Feb 2022 18:54:12 +0200 Subject: [PATCH] ci: update GH workflows --- .github/workflows/build.yml | 14 -------------- .github/workflows/release.yml | 30 +++++++++++++++++++++--------- .github/workflows/validate.yml | 32 ++++++++++++++++++++++++++++++++ package.json | 5 ++--- 4 files changed, 55 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/validate.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 41245283..00000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Build -on: - pull_request: -jobs: - build: - name: Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Build - run: | - npm install - npm run lint - npm run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c88130cb..7085ed3e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,19 +3,31 @@ on: push: branches: - master + jobs: release: - name: Prepare release + name: Release runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Build the file - run: | - cd /home/runner/work/vacuum-card/vacuum-card - npm install - npm run lint - npm run build - - name: Release + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout Repo + uses: actions/checkout@v2 + + - name: โฌข Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '*' + cache: npm + + - name: ๐Ÿ“ฆ Install Packages + run: npm ci + + - name: ๐Ÿ— Build + run: npm run build + + - name: ๐Ÿš€ Release run: npx semantic-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 00000000..63bd82b5 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,32 @@ +name: Validate +on: + push: + pull_request: + +jobs: + validate: + name: Validate + runs-on: ubuntu-latest + steps: + - name: ๐Ÿ›‘ Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.9.1 + + - name: โฌ‡๏ธ Checkout Repo + uses: actions/checkout@v2 + + - name: โฌข Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '*' + cache: npm + + - name: ๐Ÿ“ฆ Install Packages + run: npm ci + + - name: ๐Ÿงช Test + run: npm test + + - name: ๐Ÿ‘ท HACS validation + uses: hacs/action@main + with: + category: plugin diff --git a/package.json b/package.json index 8a87f7b0..3a76b07d 100755 --- a/package.json +++ b/package.json @@ -4,13 +4,12 @@ "description": "Vacuum cleaner card for Home Assistant Lovelace UI", "main": "dist/vacuum-card.js", "scripts": { - "postpublish": "git push --follow-tags", "start": "rollup -c --watch", - "compile": "rollup -c", "lint": "eslint src", "lint:fix": "eslint src --fix", "format": "prettier --write .", - "build": "npm run lint && npm run compile" + "build": "rollup -c", + "test": "npm run lint && npm run build" }, "keywords": [ "home-assistant",