refactor: remove version check job and streamline release process
This commit is contained in:
@@ -15,60 +15,8 @@ env:
|
|||||||
RUSTUP_MAX_RETRIES: 10
|
RUSTUP_MAX_RETRIES: 10
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-version:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') && !startsWith(github.ref, 'refs/tags/')
|
|
||||||
outputs:
|
|
||||||
should_release: ${{ steps.check.outputs.should_release }}
|
|
||||||
version: ${{ steps.check.outputs.version }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Check and increment version
|
|
||||||
id: check
|
|
||||||
run: |
|
|
||||||
# Get current version
|
|
||||||
VERSION=$(grep -Po '"version":\s*"\K[^"]+' src-tauri/tauri.conf.json | head -1)
|
|
||||||
echo "Current version: $VERSION"
|
|
||||||
|
|
||||||
# Check if tag exists
|
|
||||||
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
|
||||||
echo "Tag v$VERSION already exists, incrementing patch version..."
|
|
||||||
|
|
||||||
# Parse version components
|
|
||||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
|
|
||||||
NEW_PATCH=$((PATCH + 1))
|
|
||||||
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
|
|
||||||
|
|
||||||
echo "New version: $NEW_VERSION"
|
|
||||||
|
|
||||||
# Update tauri.conf.json
|
|
||||||
sed -i "s/\"version\": \"$VERSION\"/\"version\": \"$NEW_VERSION\"/" src-tauri/tauri.conf.json
|
|
||||||
|
|
||||||
# Commit and push
|
|
||||||
git config user.name "GitHub Actions"
|
|
||||||
git config user.email "actions@github.com"
|
|
||||||
git add src-tauri/tauri.conf.json
|
|
||||||
git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
|
|
||||||
git push
|
|
||||||
|
|
||||||
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
|
||||||
echo "should_release=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "Tag v$VERSION does not exist, will create release"
|
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
||||||
echo "should_release=true" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
runs-on: windows
|
runs-on: windows
|
||||||
needs: [check-version]
|
|
||||||
if: always() && (needs.check-version.result == 'success' || needs.check-version.result == 'skipped')
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -138,8 +86,6 @@ jobs:
|
|||||||
|
|
||||||
build-linux:
|
build-linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [check-version]
|
|
||||||
if: always() && (needs.check-version.result == 'success' || needs.check-version.result == 'skipped')
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -217,8 +163,6 @@ jobs:
|
|||||||
|
|
||||||
build-android:
|
build-android:
|
||||||
runs-on: windows
|
runs-on: windows
|
||||||
needs: [check-version]
|
|
||||||
if: always() && (needs.check-version.result == 'success' || needs.check-version.result == 'skipped')
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -343,26 +287,36 @@ jobs:
|
|||||||
|
|
||||||
create-release:
|
create-release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [check-version, build-windows, build-linux, build-android]
|
needs: [build-windows, build-linux, build-android]
|
||||||
if: always() && !cancelled() && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success') && (startsWith(github.ref, 'refs/tags/v') || needs.check-version.outputs.should_release == 'true')
|
if: always() && (needs.build-windows.result == 'success' || needs.build-linux.result == 'success')
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Get version from tag or check-version
|
- name: Get version
|
||||||
id: version
|
id: version
|
||||||
run: |
|
run: |
|
||||||
if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
|
VERSION=$(grep -Po '"version":\s*"\K[^"]+' src-tauri/tauri.conf.json | head -1)
|
||||||
VERSION="${{ github.ref_name }}"
|
|
||||||
VERSION="${VERSION#v}"
|
|
||||||
else
|
|
||||||
VERSION="${{ needs.check-version.outputs.version }}"
|
|
||||||
fi
|
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "Version: $VERSION"
|
||||||
|
|
||||||
|
- name: Check if tag exists
|
||||||
|
id: tag_check
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.version.outputs.VERSION }}"
|
||||||
|
if git rev-parse "v$VERSION" >/dev/null 2>&1; then
|
||||||
|
echo "Tag v$VERSION already exists"
|
||||||
|
echo "exists=true" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "Tag v$VERSION does not exist"
|
||||||
|
echo "exists=false" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Create and push tag
|
- name: Create and push tag
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
if: steps.tag_check.outputs.exists == 'false'
|
||||||
run: |
|
run: |
|
||||||
git config user.name "GitHub Actions"
|
git config user.name "GitHub Actions"
|
||||||
git config user.email "actions@github.com"
|
git config user.email "actions@github.com"
|
||||||
|
|||||||
Reference in New Issue
Block a user