Skip to content

Commit

Permalink
Add CI and release workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jcwillox committed Dec 15, 2021
1 parent 33a7261 commit e7d12a2
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/actions/engines/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Extract engines"
description: "Extract engines from package.json"
outputs:
node:
description: "node version"
value: ${{ steps.information.engines.name }}
pnpm:
description: "pnpm version"
value: ${{ steps.information.engines.description }}
runs:
using: "composite"
steps:
- id: engines
shell: bash
run: |
echo ::set-output name=node::$(jq --raw-output .engines.node ./package.json)
echo ::set-output name=pnpm::$(jq --raw-output .engines.pnpm ./package.json)
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 'CI'

on: [ push, pull_request ]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: "Checkout the repository"
uses: actions/checkout@v2

- name: "Extract engines"
id: engines
uses: ./.github/actions/engines

- name: "Setup pnpm"
uses: pnpm/action-setup@v2
with:
version: ${{ steps.engines.outputs.pnpm }}

- name: "Setup node"
uses: actions/setup-node@v2
with:
node-version: ${{ steps.engines.outputs.node }}
cache: ${{ !env.ACT && 'pnpm' || '' }}

- name: "Install dependencies"
run: pnpm install

- name: "Run Lint"
run: pnpm run lint -s

- name: "Check format"
run: pnpm run format:check

build:
name: Build & Test
runs-on: ubuntu-latest
steps:
- name: "Checkout the repository"
uses: actions/checkout@v2

- name: "Extract engines"
id: engines
uses: ./.github/actions/engines

- name: "Setup pnpm"
uses: pnpm/action-setup@v2
with:
version: ${{ steps.engines.outputs.pnpm }}

- name: "Setup node"
uses: actions/setup-node@v2
with:
node-version: ${{ steps.engines.outputs.node }}
cache: ${{ !env.ACT && 'pnpm' || '' }}

- name: "Install dependencies"
run: pnpm install

- name: "Run Build"
run: pnpm run build
17 changes: 17 additions & 0 deletions .github/workflows/hacs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Validate HACS

on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
hacs:
name: Validate HACS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hacs/action@main
with:
category: "plugin"
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'Publish'

on:
release:
types: [ published ]

jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: "Checkout the repository"
uses: actions/checkout@v2

- name: "Update version"
run: |
current="$(jq --raw-output .version package.json | sed 's/\./\\./g')"
sed -i s/$current/${{ github.event.release.tag_name }}/ package.json
- name: "Extract engines"
id: engines
uses: ./.github/actions/engines

- name: "Setup pnpm"
uses: pnpm/action-setup@v2
with:
version: ${{ steps.engines.outputs.pnpm }}

- name: "Setup node"
uses: actions/setup-node@v2
with:
node-version: ${{ steps.engines.outputs.node }}
cache: ${{ !env.ACT && 'pnpm' || '' }}

- name: "Install dependencies"
run: pnpm install

- name: "Run Build"
run: pnpm run build

- name: "Upload assets"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ github.event.release.tag_name }} dist/*

0 comments on commit e7d12a2

Please sign in to comment.