From 92f23dd01642eaa3efa09ed196245f5b43d1423e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Garn=C3=A6s?= Date: Fri, 16 Sep 2022 14:48:36 +0200 Subject: [PATCH 1/2] Move build job to separate workflow in GitHub Actions We need to customize it for use with Relative CI including running it on pushes and reacting to it in a future RelativeCI workflow. This is not needed for or related to the rest of the jobs in the pull request workflow. Consequently we move it to a sepate workflow. --- .github/workflows/build.yml | 36 ++++++++++++++++++++++++++++++ .github/workflows/pull_request.yml | 30 ------------------------- 2 files changed, 36 insertions(+), 30 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..352f4b2674 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build + +on: + push: + pull_request: + +jobs: + build: + name: Build artifacts + if: '!github.event.deleted' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # Required to fetch all commits and tags + fetch-depth: 0 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'yarn' + registry-url: 'https://npm.pkg.github.com' + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install Dependencies + run: yarn install + - name: Build artifacts + run: | + VERSION_FILE_NAME=$GITHUB_REPOSITORY \ + VERSION_FILE_VERSION=$(git describe --tags --exclude=latest) \ + yarn build + - name: Upload + uses: actions/upload-artifact@v1 + with: + name: dist + path: dist diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 61f53cd5f5..270604fd77 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -75,36 +75,6 @@ jobs: - name: Lint Javascript run: yarn lint:js - build: - name: Build artifacts - if: '!github.event.deleted' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # Required to fetch all commits and tags - fetch-depth: 0 - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - registry-url: 'https://npm.pkg.github.com' - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Install Dependencies - run: yarn install - - name: Build artifacts - run: | - VERSION_FILE_NAME=$GITHUB_REPOSITORY \ - VERSION_FILE_VERSION=$(git describe --tags --exclude=latest) \ - yarn build - - name: Upload - uses: actions/upload-artifact@v1 - with: - name: dist - path: dist - validate_docs: name: Validate documentation if: '!github.event.deleted' From e0aa650c5c654ffc730903a6e899b23f3f243a00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Garn=C3=A6s?= Date: Mon, 19 Sep 2022 11:51:10 +0200 Subject: [PATCH 2/2] Build webpack stats and upload to Relative CI This setup is in accordance with the workflow_run setup recommended by RelativeCI for projects using a fork-based workflow. https://relative-ci.com/documentation/setup/agent/github-action/#workflow_run-event --- .github/workflows/build.yml | 9 +++++++-- .github/workflows/relative_ci.yml | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/relative_ci.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 352f4b2674..f8b6b18339 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,11 +26,16 @@ jobs: run: yarn install - name: Build artifacts run: | + yarn build:css:prod VERSION_FILE_NAME=$GITHUB_REPOSITORY \ VERSION_FILE_VERSION=$(git describe --tags --exclude=latest) \ - yarn build - - name: Upload + yarn build:js:prod --json webpack-stats.json + - name: Upload build uses: actions/upload-artifact@v1 with: name: dist path: dist + - name: Upload webpack stats artifact + uses: relative-ci/agent-upload-artifact-action@v1 + with: + webpackStatsFile: ./webpack-stats.json diff --git a/.github/workflows/relative_ci.yml b/.github/workflows/relative_ci.yml new file mode 100644 index 0000000000..ed9f46a163 --- /dev/null +++ b/.github/workflows/relative_ci.yml @@ -0,0 +1,17 @@ +name: RelativeCI + +on: + workflow_run: + workflows: ["Build"] + types: + - completed + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Send webpack stats to RelativeCI + uses: relative-ci/agent-action@v2 + with: + key: ${{ secrets.RELATIVE_CI_KEY }} + token: ${{ secrets.GITHUB_TOKEN }}