From 492988ce9fe96cd363b33d5973c918ffec34479a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beltr=C3=A1n=20Garcia=20Balbuena?= Date: Mon, 8 May 2023 16:30:04 +0200 Subject: [PATCH] ci: modify release job (#1177) EMP-700 --- .github/workflows/build.yml | 52 ++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 260d1bfec2..98fb8243af 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - task: [ lint, 'test:unit', 'test:unit-cypress', 'test:e2e:ci' ] + task: [lint, 'test:unit', 'test:unit-cypress', 'test:e2e:ci'] name: ${{ matrix.task }} container: image: cypress/browsers:node-18.16.0-chrome-112.0.5615.121-1-ff-112.0.1-edge-112.0.1722.48-1 @@ -60,26 +60,58 @@ jobs: with: path: | node_modules/.cache - key: lerna-cache-${{github.sha}}-${{matrix.task}} + key: lerna-cache-${{matrix.task}}-${{github.sha}} restore-keys: | - lerna-cache-${{github.sha}} - lerna-cache- + lerna-cache-${{matrix.task}} - name: install dependencies run: pnpm install - name: Run ${{ matrix.task }} run: npm run ${{ matrix.task }} - release: - needs: [ build ] + if: + ${{ github.ref_name == 'main' && github.actor != 'support-empathy' && + !startsWith(github.event.head_commit.message, 'chore(release):') }} + needs: [build] runs-on: ubuntu-latest steps: + - name: checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + persist-credentials: false + # Install pnpm because it is not included in our container image + - name: install pnpm + uses: pnpm/action-setup@v2 + with: + version: 7 + + - name: setup pnpm cache + id: pnpm-cache + uses: actions/cache@v3 + with: + path: | + ${{ steps.setup-env-vars.outputs.PNPM_STORE_PATH }} + ${{ steps.setup-env-vars.outputs.CYPRESS_CACHE_FOLDER }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: setup lerna cache + id: lerna-cache + uses: actions/cache/restore@v3 + with: + path: | + node_modules/.cache + restore-keys: | + lerna-cache- + + - name: install dependencies + run: pnpm install + - name: Release alpha on non-release pushes to main branch - if: - ${{ github.ref_name == 'main' && github.actor != 'support-empathy' && - !startsWith(github.event.head_commit.message, 'chore(release):') }} uses: ./.github/actions/release-alpha with: npm_token: ${{ secrets.NPM_TOKEN }} - github_token: ${{ secrets.SUPPORT_TOKEN }} \ No newline at end of file + github_token: ${{ secrets.SUPPORT_TOKEN }}