From 5aff1070b1234fd4a2f8898f5a351ea62c70d4d0 Mon Sep 17 00:00:00 2001 From: 4gray Date: Mon, 3 Jan 2022 12:19:11 +0100 Subject: [PATCH] ci: add workflow to build pwa --- .github/workflows/ci.yaml | 116 +++++++++++++++++++++----------------- package.json | 3 +- 2 files changed, 67 insertions(+), 52 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4e5db2935..634753732 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,62 +1,76 @@ name: Build and release on: - push: - branches: - - electron - pull_request: - branches: - - electron + push: + branches: + - electron + pull_request: + branches: + - electron jobs: - build-and-test: - runs-on: ubuntu-latest + build-and-test: + runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - - name: Use Node.js - uses: actions/setup-node@v1 - with: - node-version: "16.x" - - run: git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf ssh://git@github.com/ - - run: npm ci - - run: npm test -- --coverage - - run: bash <(curl -s https://codecov.io/bash) - - run: xvfb-run --auto-servernum npm run e2e - - run: npm run build:prod - env: - CI: true - release: - needs: [build-and-test] - runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + - name: Use Node.js + uses: actions/setup-node@v1 + with: + node-version: '16.x' + - run: git config --global url."https://${{ secrets.PAT }}@github.com/".insteadOf ssh://git@github.com/ + - run: npm ci + - run: npm test -- --coverage + - run: bash <(curl -s https://codecov.io/bash) + - run: xvfb-run --auto-servernum npm run e2e + - run: npm run build:prod + env: + CI: true + build-and-deploy: + needs: [build-and-test] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 - strategy: - matrix: - os: [macos-latest, ubuntu-latest, windows-latest] + - name: Build and Deploy + uses: JamesIves/github-pages-deploy-action@master + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH: gh-pages + FOLDER: dist + BUILD_SCRIPT: npm install && npm run-script build-and-deploy-pwa + release: + needs: [build-and-test] + runs-on: ${{ matrix.os }} - steps: - - name: Check out Git repository - uses: actions/checkout@v1 + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] - - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v1 - with: - node-version: "16.x" + steps: + - name: Check out Git repository + uses: actions/checkout@v1 - - name: Build Electron app - uses: samuelmeuli/action-electron-builder@v1 - with: - # GitHub token, automatically provided to the action - # (No need to define this secret in the repo settings) - github_token: ${{ secrets.github_token }} + - name: Install Node.js, NPM and Yarn + uses: actions/setup-node@v1 + with: + node-version: '16.x' - # If the commit is tagged with a version (e.g. "v1.0.0"), - # release the app after building - release: ${{ startsWith(github.ref, 'refs/tags/v') }} - - name: Archive production artifacts - uses: actions/upload-artifact@v2 - with: - name: dev-release - path: ./release/iptvnator* + - name: Build Electron app + uses: samuelmeuli/action-electron-builder@v1 + with: + # GitHub token, automatically provided to the action + # (No need to define this secret in the repo settings) + github_token: ${{ secrets.github_token }} + + # If the commit is tagged with a version (e.g. "v1.0.0"), + # release the app after building + release: ${{ startsWith(github.ref, 'refs/tags/v') }} + - name: Archive production artifacts + uses: actions/upload-artifact@v2 + with: + name: dev-release + path: ./release/iptvnator* diff --git a/package.json b/package.json index 8dc78caff..18cf167f6 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "e2e": "npm run build:prod && cross-env TS_NODE_PROJECT='e2e/tsconfig.e2e.json' mocha e2e/**/*.ts --config ./.mocharc.json --exit", "e2e:watch": "npm run e2e -- --watch", "version": "conventional-changelog -i CHANGELOG.md -p angular -s -r 0 && git add CHANGELOG.md", - "lint": "ng lint" + "lint": "ng lint", + "build-and-deploy-pwa": "ng build -c production --base-href '/iptvnator'" }, "dependencies": { "@angular/animations": "13.0.2",