diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 57c9e0d7..6c2a797f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,34 +4,42 @@ on: push: branches: - main - - develop/* + - test/* jobs: build-deploy: runs-on: ubuntu-latest - + name: Build steps: - - uses: actions/checkout@v2 - - name: Use Node.js - uses: actions/setup-node@v1 - with: - node-version: '16.x' + - uses: actions/checkout@v2 + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '16.x' + + - name: Cache Node.js modules + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.OS }}-node- + ${{ runner.OS }}- - - name: Cache Node.js modules - uses: actions/cache@v2 - with: - path: ~/.npm - key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.OS }}-node- - ${{ runner.OS }}- + - name: Package with Node + env: + CHROME_PEM: ${{ secrets.CHROME_PEM }} + run: | + mkdir dist + echo "$CHROME_PEM" > ./dist/scriptcat.pem + chmod 600 ./dist/scriptcat.pem + npm ci + npm run pack - - name: Package with Node - env: - CHROME_PEM: ${{ secrets.CHROME_PEM }} - run: | - mkdir dist - echo "$CHROME_PEM" > ./dist/scriptcat.pem - chmod 600 ./dist/scriptcat.pem - npm ci - npm run pack + - name: Archive production artifacts + uses: actions/upload-artifact@v3 + with: + name: scriptcat-extension + path: | + dist/*.zip + dist/*.crx diff --git a/.github/workflows/packageRelease.yml b/.github/workflows/packageRelease.yml index 96b826be..ec7d2b58 100644 --- a/.github/workflows/packageRelease.yml +++ b/.github/workflows/packageRelease.yml @@ -15,7 +15,7 @@ jobs: - name: Use Node.js uses: actions/setup-node@v1 with: - node-version: "14.x" + node-version: "16.x" - name: Cache Node.js modules uses: actions/cache@v2 @@ -33,7 +33,7 @@ jobs: mkdir dist echo "$CHROME_PEM" > ./dist/scriptcat.pem chmod 600 ./dist/scriptcat.pem - npm ci + npm ci npm test npm run pack @@ -57,8 +57,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/scriptcat-${{ github.ref }}-chrome.zip - asset_name: scriptcat-${{ github.ref }}-chrome.zip + asset_path: ./dist/scriptcat-${{ github.ref_name }}-chrome.zip + asset_name: scriptcat-${{ github.ref_name }}-chrome.zip asset_content_type: application/zip - name: Upload FireFox Release Asset zip @@ -68,8 +68,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/scriptcat-${{ github.ref }}-firefox.zip - asset_name: scriptcat-${{ github.ref }}-firefox.zip + asset_path: ./dist/scriptcat-${{ github.ref_name }}-firefox.zip + asset_name: scriptcat-${{ github.ref_name }}-firefox.zip asset_content_type: application/zip - name: Upload Crx Release Asset zip @@ -79,6 +79,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./dist/scriptcat-${{ github.ref }}-chrome.crx - asset_name: scriptcat-${{ github.ref }}-chrome.crx + asset_path: ./dist/scriptcat-${{ github.ref_name }}-chrome.crx + asset_name: scriptcat-${{ github.ref_name }}-chrome.crx asset_content_type: application/zip \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c5d46f73..1430e57d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,7 +30,7 @@ jobs: - name: Unit Test run: | npm ci - npm run test + npm test - name: Upload coverage reports to Codecov with GitHub Action uses: codecov/codecov-action@v3