Skip to content

A local-first personal finance app

ci: turn boilerplate into composite action

Tom French883df58724db
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
new file mode 100644
index 0000000000..c628ff28ff
--- /dev/null
+++ b/.github/actions/setup/action.yml
@@ -0,0 +1,19 @@
+name: Setup
+
+runs:
+ using: composite
+ steps:
+ - name: Install node
+ uses: actions/setup-node@v1
+ with:
+ node-version: 16
+ - name: Cache
+ uses: actions/cache@v2
+ id: cache
+ with:
+ path: '**/node_modules'
+ key: yarn-v1-${{ hashFiles('**/yarn.lock') }}
+ - name: Install
+ run: yarn --immutable
+ shell: bash
+ if: steps.cache.outputs.cache-hit != 'true'
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index fac7559ff9..1a308221ba 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -19,19 +19,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- - name: Install node
- uses: actions/setup-node@v1
- with:
- node-version: 16
- - name: Cache
- uses: actions/cache@v2
- id: cache
- with:
- path: '**/node_modules'
- key: yarn-v1-${{ hashFiles('**/yarn.lock') }}
- - name: Install
- run: yarn --immutable
- if: steps.cache.outputs.cache-hit != 'true'
+ - name: Set up environment
+ uses: ./.github/actions/setup
- name: Build API
run: cd packages/loot-core && yarn build:api
@@ -39,19 +28,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- - name: Install node
- uses: actions/setup-node@v1
- with:
- node-version: 16
- - name: Cache
- uses: actions/cache@v2
- id: cache
- with:
- path: '**/node_modules'
- key: yarn-v1-${{ hashFiles('**/yarn.lock') }}
- - name: Install
- run: yarn --immutable
- if: steps.cache.outputs.cache-hit != 'true'
+ - name: Set up environment
+ uses: ./.github/actions/setup
- name: Build Web
run: ./bin/package-browser
@@ -67,18 +45,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- - name: Install node
- uses: actions/setup-node@v1
- with:
- node-version: 16
- - name: Cache
- uses: actions/cache@v2
- id: cache
- with:
- path: '**/node_modules'
- key: yarn-v1-${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
- - name: Install
- run: yarn --immutable
- if: steps.cache.outputs.cache-hit != 'true'
+ - name: Set up environment
+ uses: ./.github/actions/setup
- name: Build Electron
run: ./bin/package
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 3a1ccb7135..10fc5f3bb0 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -12,18 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- - name: Install node
- uses: actions/setup-node@v1
- with:
- node-version: 16
- - name: Cache
- uses: actions/cache@v2
- id: cache
- with:
- path: '**/node_modules'
- key: yarn-v1-${{ hashFiles('**/yarn.lock') }}
- - name: Install
- run: yarn --immutable
- if: steps.cache.outputs.cache-hit != 'true'
+ - name: Set up environment
+ uses: ./.github/actions/setup
- name: Lint
run: yarn lint