From bf261da923fea0ef542a7a801a5314c687630f4b Mon Sep 17 00:00:00 2001 From: Cameron Date: Mon, 17 Jun 2024 03:43:18 -0600 Subject: [PATCH] main and develop --- .github/workflows/develop.yml | 40 ++++++----- .github/workflows/main.yml | 127 +++++++++++++++++++++++----------- 2 files changed, 109 insertions(+), 58 deletions(-) diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml index ebf7dd5d..5b4a4f79 100644 --- a/.github/workflows/develop.yml +++ b/.github/workflows/develop.yml @@ -8,9 +8,28 @@ concurrency: cancel-in-progress: true jobs: + version-bump: + name: 🔢 Version Bump + runs-on: ubuntu-latest + needs: publish-release + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Automated Version Bump + uses: phips28/gh-action-bump-version@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + commit-message: 'CI: bumps version to {{version}} [skip ci]' + skip-tag: 'true' + build-linux: name: 🏗️ Build Linux runs-on: ubuntu-latest + needs: version-bump steps: - name: ⬇️ Checkout repo uses: actions/checkout@v4 @@ -35,6 +54,7 @@ jobs: build-windows: name: 🏗️ Build Windows runs-on: windows-latest + needs: version-bump strategy: fail-fast: false steps: @@ -114,7 +134,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: v${{ steps.project-version.outputs.version }} - release_name: Release ${{ steps.project-version.outputs.version }} + release_name: v${{ steps.project-version.outputs.version }} draft: false prerelease: true @@ -139,21 +159,3 @@ jobs: asset_path: dist/LinguifAI Setup ${{ steps.project-version.outputs.version }}.exe asset_name: LinguifAI-Setup-${{ steps.project-version.outputs.version }}.exe asset_content_type: application/octet-stream - - version-bump: - name: 🔢 Version Bump - runs-on: ubuntu-latest - needs: publish-release - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Automated Version Bump - uses: phips28/gh-action-bump-version@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - commit-message: 'CI: bumps version to {{version}} [skip ci]' - skip-tag: 'true' diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 65419345..331ce26e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,15 +11,12 @@ jobs: version-bump: name: 🔢 Version Bump runs-on: ubuntu-latest + needs: publish-release steps: - name: ⬇️ Checkout repo uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Get version of the project - id: project-version - uses: euberdeveloper/ga-project-version@main - name: Automated Version Bump uses: phips28/gh-action-bump-version@master @@ -29,8 +26,33 @@ jobs: commit-message: 'feat: bumps minor version to {{version}} [skip ci]' skip-tag: 'true' - build: - name: 🏗️ Build + build-linux: + name: 🏗️ Build Linux + runs-on: ubuntu-latest + needs: version-bump + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install dependencies + run: npm install + + - name: 📦 Electron Builder Linux + run: npm run electron:package:linux + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload Linux artifact + uses: actions/upload-artifact@v2 + with: + name: LinguifAI-Linux + path: dist/*.AppImage + + + build-windows: + name: 🏗️ Build Windows runs-on: windows-latest needs: version-bump strategy: @@ -46,10 +68,6 @@ jobs: with: cache: "npm" - - name: Get version of the project - id: project-version - uses: euberdeveloper/ga-project-version@main - - name: Set up conda uses: conda-incubator/setup-miniconda@v2 with: @@ -70,43 +88,74 @@ jobs: - name: Install dependencies run: npm install - - name: 📦 Electron Builder + - name: 📦 Electron Builder Windows run: npm run electron:package:win env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Get version of the project after bump - id: project-version-after + - name: Upload Windows artifact + uses: actions/upload-artifact@v2 + with: + name: LinguifAI-Windows + path: dist/*.exe + + publish-release: + name: 🚀 Publish Release + runs-on: ubuntu-latest + needs: [build-linux, build-windows] + steps: + - name: ⬇️ Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get version of the project + id: project-version uses: euberdeveloper/ga-project-version@main - - - name: Get latest release number - id: get_latest_release - uses: actions/github-script@v4 + + - name: Download Linux artifact + uses: actions/download-artifact@v2 with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const response = await github.repos.listReleases({ - owner: context.repo.owner, - repo: context.repo.repo, - per_page: 10 - }); - - const latestPreRelease = response.data[0]; - const preReleaseTag = latestPreRelease.name; - const versionParts = preReleaseTag.replace(/^v/, '').split('.'); - const newV = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])+1}.0`; - console.log(`::set-output name=new_version::${newV}`); - - - name: Rename file - run: ren "dist\LinguifAI Setup ${{ steps.project-version-after.outputs.version }}.exe" "LinguifAI Setup ${{ steps.get_latest_release.outputs.new_version }}.exe" + name: LinguifAI-Linux + path: dist/ + + - name: Download Windows artifact + uses: actions/download-artifact@v2 + with: + name: LinguifAI-Windows + path: dist/ + + - run: tree - name: Create Release id: create_release - uses: softprops/action-gh-release@v1 + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - files: | - ./dist/LinguifAI\ Setup\ ${{ steps.get_latest_release.outputs.new_version }}.exe - tag_name: v${{ steps.get_latest_release.outputs.new_version }} - name: v${{ steps.get_latest_release.outputs.new_version }} + tag_name: v${{ steps.project-version.outputs.version }} + release_name: v${{ steps.project-version.outputs.version }} + draft: false prerelease: true - body: ${{ github.event.head_commit.message }} \ No newline at end of file + + - name: Upload Linux artifact + id: upload-linux + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/LinguifAI-${{ steps.project-version.outputs.version }}.AppImage + asset_name: LinguifAI-${{ steps.project-version.outputs.version }}.AppImage + asset_content_type: application/octet-stream + + - name: Upload Windows artifact + id: upload-windows + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dist/LinguifAI Setup ${{ steps.project-version.outputs.version }}.exe + asset_name: LinguifAI-Setup-${{ steps.project-version.outputs.version }}.exe + asset_content_type: application/octet-stream