From 90dc7f041f8115e0a583f2c024aea2dc3339058f Mon Sep 17 00:00:00 2001 From: Garry Lachman Date: Mon, 22 May 2023 18:09:19 +0300 Subject: [PATCH] fix: ci --- .github/workflows/publish.yml | 51 +++++++++++------------------------ .github/workflows/tagging.yml | 51 +++++++++++++++++++++++++++++++++++ .releaserc | 14 +--------- package.json | 10 +++++-- 4 files changed, 76 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/tagging.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f388974e..5b1d0608 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,9 @@ -name: Publish +name: Build/release on: - workflow_dispatch: push: - branches: - - develop + tags: + - '*' concurrency: ci-${{ github.workflow }} @@ -23,10 +22,6 @@ jobs: fetch-depth: 0 token: ${{ secrets.GH_TOKEN_SEMANTIC_RELEASE }} - - uses: shogo82148/actions-mutex@v1 - with: - key: build-mutex - - name: apt-get install if: matrix.os == 'ubuntu-latest' run: sudo apt update -y && sudo apt-get install -y snapd rpm snapcraft fakeroot dpkg @@ -38,6 +33,10 @@ jobs: node-version: 18.11.0 cache: 'yarn' + - uses: shogo82148/actions-mutex@v1 + with: + key: build-mutex + - name: Install deps run: yarn install @@ -47,34 +46,16 @@ jobs: - name: Build packages run: yarn run build - #- name: Build Electron app - # run: yarn run make - # env: - # # 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: Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - run: yarn semantic-release + - name: Build/release 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: Build/release 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') }} + # 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: 'Electro Forge Publish' # run: yarn run publish diff --git a/.github/workflows/tagging.yml b/.github/workflows/tagging.yml new file mode 100644 index 00000000..396d8510 --- /dev/null +++ b/.github/workflows/tagging.yml @@ -0,0 +1,51 @@ +name: Build/prepare + +on: + workflow_dispatch: + push: + branches: + - develop + +concurrency: ci-${{ github.workflow }} + +jobs: + build-and-publish: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest] + + steps: + - 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 and Yarn + uses: actions/setup-node@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + node-version: 18.11.0 + cache: 'yarn' + + - name: Install deps + run: yarn install + + - name: Install global lerna + run: yarn global add lerna + + - name: Test + run: yarn run test + + - name: Semantic Release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: yarn semantic-release diff --git a/.releaserc b/.releaserc index ab7009da..ef933cfc 100644 --- a/.releaserc +++ b/.releaserc @@ -3,18 +3,6 @@ "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", - ["@semantic-release/npm"], - ["@semantic-release/exec", { - "prepareCmd": "yarn run make" - }], - ["@semantic-release/github", { - "assets": [ - { "path": "out/make/**/electrocrud*.zip", "name": "ElectroCRUD-mac-${nextRelease.gitTag}.zip", "label": "ElectroCRUD MacOS (${nextRelease.gitTag})" }, - { "path": "out/make/**/electrocrud*.exe", "name": "ElectroCRUD-windows-${nextRelease.gitTag}.exe", "label": "ElectroCRUD Windows (${nextRelease.gitTag})" }, - { "path": "out/make/**/electrocrud*.AppImage", "name": "ElectroCRUD-linux-${nextRelease.gitTag}.AppImage", "label": "ElectroCRUD Linux (${nextRelease.gitTag})" }, - { "path": "out/make/**/electrocrud*.deb", "name": "ElectroCRUD-linux-${nextRelease.gitTag}.deb", "label": "ElectroCRUD Linux (deb) (${nextRelease.gitTag})" }, - { "path": "out/make/**/electrocrud*.rpm", "name": "ElectroCRUD-linux-${nextRelease.gitTag}.rpm", "label": "ElectroCRUD Linux (rpm) (${nextRelease.gitTag})" }, - { "path": "out/make/**/electrocrud*.snap", "name": "ElectroCRUD-linux-${nextRelease.gitTag}.snap", "label": "ElectroCRUD Linux (snap) (${nextRelease.gitTag})" } - ]}] + ["@semantic-release/npm"] ] } \ No newline at end of file diff --git a/package.json b/package.json index ddd6eb60..ec630a3a 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "test": "NODE_OPTIONS=--experimental-vm-modules npx jest packages", "make": "cross-env NODE_OPTIONS='--max-old-space-size=8192' DEBUG=* REFORGED_APPIMAGEKIT_CUSTOM_FILENAME='ElectroCRUD-linux' electron-forge make", "build": "yarn lerna run build", - "semantic-release": "semantic-release" + "semantic-release": "semantic-release --debug" }, "lint-staged": { "*.{js,jsx,ts,tsx}": [ @@ -309,5 +309,11 @@ "workspaces": [ "packages/*" ], - "private": true + "private": true, + "build": { + "appId": "com.garrylachman.electrocrud", + "productName": "ElectroCRUD", + "copyright": "Copyright © 2023 Garry Lachman", + "asar": false + } }