Skip to content

Commit

Permalink
fix: 🐛 pass version from prepare to build job
Browse files Browse the repository at this point in the history
  • Loading branch information
garrylachman committed May 25, 2023
1 parent 0cc77a4 commit bbbb1dc
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 124 deletions.
98 changes: 0 additions & 98 deletions .github/workflows/prepare.yml

This file was deleted.

87 changes: 62 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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'
Expand All @@ -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
3 changes: 2 additions & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit bbbb1dc

Please sign in to comment.