Skip to content

Commit

Permalink
Update develop.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaloney111 authored Jun 10, 2024
1 parent 8268010 commit 6127946
Showing 1 changed file with 25 additions and 34 deletions.
59 changes: 25 additions & 34 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,14 @@ jobs:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 2
fetch-depth: 0 # Ensure full history is fetched for tagging

- name: Set up conda
uses: conda-incubator/setup-miniconda@v2
with:
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:
Expand All @@ -49,42 +44,38 @@ jobs:
- name: Install dependencies
run: npm install

- name: 📦 Electron Builder
run: npm run electron:package:win
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bump version
id: bump_version
run: |
# Bump version using npm
CURRENT_VERSION=$(jq -r '.version' package.json)
NEW_VERSION=$(npm version patch -m "chore(release): $CURRENT_VERSION -> %s [skip ci]")
NEW_VERSION=$(echo $NEW_VERSION | tr -d 'v') # Remove the 'v' prefix
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
- name: Print directory tree
run: tree

- name: Get latest release number
id: get_latest_release
uses: actions/github-script@v4
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 newVersion = `${parseInt(versionParts[0])}.${parseInt(versionParts[1])}.${parseInt(versionParts[2]) + 1}`;
console.log(`::set-output name=new_version::${newVersion}`);
- name: Commit new version
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -am "chore: bump version to ${{ env.NEW_VERSION }}"
git tag v${{ env.NEW_VERSION }}
git push origin develop --tags
- name: Rename file
run: ren "dist\LinguifAI Setup 0.1.0.exe" "LinguifAI Setup ${{ steps.get_latest_release.outputs.new_version }}.exe"
run: |
OLD_NAME=$(ls dist | grep 'LinguifAI Setup')
NEW_NAME="LinguifAI Setup ${{ env.NEW_VERSION }}.exe"
mv "dist/$OLD_NAME" "dist/$NEW_NAME"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
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 }}
./dist/LinguifAI\ Setup\ ${{ env.NEW_VERSION }}.exe
tag_name: v${{ env.NEW_VERSION }}
name: v${{ env.NEW_VERSION }}
prerelease: true
body: ${{ github.event.head_commit.message }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 6127946

Please sign in to comment.