From bbbb1dcd945775d5541e559e9c8bfa8134768d71 Mon Sep 17 00:00:00 2001 From: Garry Lachman Date: Fri, 26 May 2023 01:42:35 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20pass=20version=20from=20p?= =?UTF-8?q?repare=20to=20build=20job?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/prepare.yml | 98 ----------------------------------- .github/workflows/release.yml | 87 ++++++++++++++++++++++--------- .releaserc | 3 +- 3 files changed, 64 insertions(+), 124 deletions(-) delete mode 100644 .github/workflows/prepare.yml diff --git a/.github/workflows/prepare.yml b/.github/workflows/prepare.yml deleted file mode 100644 index ab007ca2..00000000 --- a/.github/workflows/prepare.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Prepare - -on: - workflow_dispatch: - push: - branches: - - develop - -jobs: - build-prepare: - name: Prepare - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-latest] - - steps: - - name: Checkout git repo - uses: actions/checkout@v3.0.0 - with: - fetch-depth: 0 - persist-credentials: false - - - name: Install Node - uses: actions/setup-node@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - node-version: 18.11.0 - - - name: Install Yarn - run: corepack enable | - corepack prepare yarn@3.5.1 --activate | - corepack yarn config set enableImmutableInstalls false - - - name: Install dependencies - run: corepack yarn install - - - name: Building Packages - run: corepack yarn build - - - name: Testing - run: corepack yarn run test - - - name: Semantic Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: corepack yarn run semantic-release - build-release: - needs: build-prepare - name: Release - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [macos-latest, ubuntu-latest, windows-2019] - - steps: - - name: Sleep for 30 seconds - run: sleep 30s - shell: bash - - name: Checkout git repo - uses: actions/checkout@v3.0.0 - with: - fetch-depth: 0 - token: ${{ secrets.GH_TOKEN_SEMANTIC_RELEASE }} - - - name: apt-get install - if: matrix.os == 'ubuntu-latest' - run: sudo apt update -y && sudo apt-get install -y snapd rpm snapcraft fakeroot dpkg - - - name: Install Node - uses: actions/setup-node@v3 - with: - token: ${{ secrets.GITHUB_TOKEN }} - node-version: 18.11.0 - - - name: Install Yarn - run: corepack enable | - corepack prepare yarn@3.5.1 --activate | - corepack yarn config set enableImmutableInstalls false | - corepack yarn cache clean - - - name: Install dependencies - run: corepack yarn install - - - name: Building Packages - run: corepack yarn run build - - - name: Publish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_OPTIONS: --max-old-space-size=8192 - DEBUG: '*' - run: corepack yarn electron-forge publish diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0a887861..4681a5d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,18 +2,63 @@ name: Release on: workflow_dispatch: - workflow_run: - workflows: [Prepare] - types: [completed] - branches: [develop] + push: + branches: + - develop jobs: - build-release: - if: ${{ github.event.workflow_run.conclusion != 'failure' }} - name: Release + prepare: + name: Prepare runs-on: ${{ matrix.os }} strategy: + matrix: + os: [ubuntu-latest] + + outputs: + next_version: ${{ steps.semantic_step.outputs.next_version }} + + steps: + - name: Checkout git repo + uses: actions/checkout@v3.0.0 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Install Node + uses: actions/setup-node@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + node-version: 18.11.0 + + - name: Install Yarn + run: corepack enable | + corepack prepare yarn@3.5.1 --activate | + corepack yarn config set enableImmutableInstalls false + + - name: Install dependencies + run: corepack yarn install + + - name: Building Packages + run: corepack yarn build + + - name: Testing + run: corepack yarn run test + + - name: Semantic Release + id: semantic_step + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: corepack yarn run semantic-release + release: + needs: prepare + name: Release v${{ needs.prepare.outputs.next_version }} + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false matrix: os: [macos-latest, ubuntu-latest, windows-2019] @@ -23,6 +68,7 @@ jobs: with: fetch-depth: 0 token: ${{ secrets.GH_TOKEN_SEMANTIC_RELEASE }} + ref: v${{ needs.prepare.outputs.next_version }} - name: apt-get install if: matrix.os == 'ubuntu-latest' @@ -36,28 +82,19 @@ jobs: - name: Install Yarn run: corepack enable | - corepack prepare yarn@3.5.1 --activate - - - name: Extract cached dependencies - uses: actions/setup-node@v3 - with: - cache: yarn - - - name: Update dependencies - run: corepack yarn --immutable - - - name: Yarn Plugins - run: yarn plugin import plugin-workspace-tools && - yarn plugin import plugin-typescript && - yarn plugin import https://yarn.build/latest + corepack prepare yarn@3.5.1 --activate | + corepack yarn config set enableImmutableInstalls false | + corepack yarn cache clean - - name: Install Dependecies - run: yarn install + - name: Install dependencies + run: corepack yarn install - name: Building Packages - run: yarn build + run: corepack yarn run build - name: Publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: yarn electron-forge publish + NODE_OPTIONS: --max-old-space-size=8192 + DEBUG: '*' + run: corepack yarn electron-forge publish diff --git a/.releaserc b/.releaserc index 17ca3ab8..eea9e3e6 100644 --- a/.releaserc +++ b/.releaserc @@ -18,7 +18,8 @@ ], "@semantic-release/github", ["@semantic-release/exec", { - "prepareCmd": "yarn lerna version ${nextRelease.version} --no-git-tag-version --force-publish --no-push --yes" + "prepareCmd": "yarn lerna version ${nextRelease.version} --no-git-tag-version --force-publish --no-push --yes", + "successCmd": "echo \"next_version=$BUILD_ID\" >> $GITHUB_OUTPUT" }], ["@semantic-release/npm", { "npmPublish": false