diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 26cfe58b..65419345 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,105 +1,54 @@ name: CI -# Controls when the workflow will run on: push: branches: ["main"] -# Prevent duplicate workflows from running concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - # Static tests don't involve any logic or context. - # They are just a set of tests that can detect if we are not introducing any faulty code. - static-test: - name: 🔬 Static tests + version-bump: + name: 🔢 Version Bump runs-on: ubuntu-latest steps: - name: ⬇️ Checkout repo uses: actions/checkout@v4 with: - fetch-depth: 2 + fetch-depth: 0 - - name: ⎔ Setup Node - uses: actions/setup-node@v3 + - 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 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - cache: "npm" - - - name: 🟨 Setup Python - uses: actions/setup-python@v3 + commit-message: 'feat: bumps minor version to {{version}} [skip ci]' + skip-tag: 'true' - - name: 📦 Install Node dependencies - run: npm install - - # # Unit tests are tests that are not dependent on any external service. - # # Usually, they are tests that are testing the logic of a specific function or component. - unit-test: - needs: [static-test] - name: 🚦 Unit tests - runs-on: ubuntu-latest + build: + name: 🏗️ Build + runs-on: windows-latest + needs: version-bump + strategy: + fail-fast: false steps: - name: ⬇️ Checkout repo uses: actions/checkout@v4 with: - fetch-depth: 2 + fetch-depth: 0 - name: ⎔ Setup Node uses: actions/setup-node@v3 with: cache: "npm" - - name: 🟨 Setup Python - uses: actions/setup-python@v3 - - - name: 📦 Install dependencies - run: npm install - - - name: 🚦 Run unit tests - run: npm test - - # # Integration tests are tests that are dependent on external services. - integration-test: - needs: [static-test] - name: 🚥 Integration tests - runs-on: ubuntu-latest - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: ⎔ Setup Node - uses: actions/setup-node@v3 - with: - cache: "npm" - - - name: 🟨 Setup Python - uses: actions/setup-python@v3 - - - name: 📦 Install dependencies - run: npm install - - # - name: 🐳 Docker compose - # run: - # docker-compose up -d && sleep 3 && pnpm prisma migrate reset --force - # --skip-seed - - - name: 🚦 Run integration tests - run: npm test - - # Create Build - build: - needs: [static-test, unit-test, integration-test] - name: 🏗️ Build - runs-on: windows-latest - strategy: - fail-fast: false - steps: - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 2 + - 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 @@ -107,16 +56,6 @@ jobs: activate-environment: default environment-file: api/environment.yml - - name: ⬇️ Checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: ⎔ Setup Node - uses: actions/setup-node@v3 - with: - cache: "npm" - - name: 🟨 Setup Python uses: actions/setup-python@v3 with: @@ -136,9 +75,10 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Print directory tree - run: tree - + - name: Get version of the project after bump + id: project-version-after + uses: euberdeveloper/ga-project-version@main + - name: Get latest release number id: get_latest_release uses: actions/github-script@v4 @@ -154,25 +94,12 @@ jobs: const latestPreRelease = response.data[0]; const preReleaseTag = latestPreRelease.name; const versionParts = preReleaseTag.replace(/^v/, '').split('.'); - const newVersion = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])+1}.0`; - console.log(`::set-output name=new_version::${newVersion}`); + 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 0.1.0.exe" "LinguifAI Setup ${{ steps.get_latest_release.outputs.new_version }}.exe" + run: ren "dist\LinguifAI Setup ${{ steps.project-version-after.outputs.version }}.exe" "LinguifAI Setup ${{ steps.get_latest_release.outputs.new_version }}.exe" - - name: Get latest commit message - id: get_latest_commit_message - uses: actions/github-script@v4 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const response = await github.repos.listCommits({ - owner: context.repo.owner, - repo: context.repo.repo, - per_page: 1, - }); - console.log(`::set-output name=commit_message::${response.data[0].commit.message}`); - - name: Create Release id: create_release uses: softprops/action-gh-release@v1 @@ -182,4 +109,4 @@ jobs: tag_name: v${{ steps.get_latest_release.outputs.new_version }} name: v${{ steps.get_latest_release.outputs.new_version }} prerelease: true - body: ${{ steps.get_latest_commit_message.outputs.commit_message }} + body: ${{ github.event.head_commit.message }} \ No newline at end of file diff --git a/package.json b/package.json index 32969e38..d7ae829d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "name": "TailLinguifAI", "email": "" }, - "version": "0.3.11", + "version": "0.2.0", "main": "./public/electron.js", "homepage": "./", "private": true,