From d4f92d006cdfbff2df160d4508181a692a317517 Mon Sep 17 00:00:00 2001 From: Alexis Tyler Date: Sat, 27 Mar 2021 11:41:56 -0700 Subject: [PATCH] chore: rework github actions --- .../workflows/{production.yml => main.yml} | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) rename .github/workflows/{production.yml => main.yml} (79%) diff --git a/.github/workflows/production.yml b/.github/workflows/main.yml similarity index 79% rename from .github/workflows/production.yml rename to .github/workflows/main.yml index 3fceb817b..f3c1c381a 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Production +name: CI - Main on: push: @@ -67,31 +67,51 @@ jobs: - name: Checkout repo uses: actions/checkout@v1 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Add SSH deploy key uses: shimataro/ssh-key-action@v2 with: key: ${{ secrets.UNRAID_BOT_SSH_KEY }} known_hosts: ${{ secrets.KNOWN_HOSTS }} + - name: Install node v${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Cache npm cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Installing node deps run: npm install - - name: Run build - run: npm run build - # See https://github.com/apollographql/subscriptions-transport-ws/issues/433 - name: Patch subscriptions-transport-ws run: npm run patch:subscriptions-transport-ws + - name: Compile to javascript + run: npm run build + + - name: Clean node_modules + run: npm run clean && curl -sf https://gobinaries.com/tj/node-prune | sh && node-prune + + - name: Build binary + run: npm run build-binary + - name: Pack release run: npm pack + - uses: actions/upload-artifact@v2 + with: + name: unraid-api + path: ${{ github.workspace }}/*.tgz + - name: Release to Github and s3 + if: startsWith(github.ref, 'refs/tags/') uses: unraid/release-action@master env: GITHUB_USER: "unraid"