summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/package-win.yml9
-rw-r--r--.github/workflows/package.yml8
-rw-r--r--.github/workflows/release.yml65
3 files changed, 63 insertions, 19 deletions
diff --git a/.github/workflows/package-win.yml b/.github/workflows/package-win.yml
index 5a98fa8..185b04e 100644
--- a/.github/workflows/package-win.yml
+++ b/.github/workflows/package-win.yml
@@ -63,13 +63,16 @@ jobs:
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }}
run: |
$TAG = "${{ steps.get_tag.outputs.tag }}"
- gh release download $TAG -p "mikusays-windows-*.exe"
+ $Version = "${{ steps.get_version.outputs.version }}"
+ gh release download $TAG -p "mikusays-windows-x86_64-$Version.exe"
+ gh release download $TAG -p "mikusays-windows-aarch64-$Version.exe"
- name: Generate NSIS Script
shell: pwsh
run: |
$Version = "${{ steps.get_version.outputs.version }}"
$InstallerName = "mikusays-windows-inst-any-$Version.exe"
+ $UploadName = "mikusays-windows-inst-any-$Version.exe"
# Prepend 0. to create a 4-part version string (0.X.Y.Z)
$NsisVersion = "0.$Version"
@@ -281,5 +284,5 @@ jobs:
run: |
$TAG = "${{ steps.get_tag.outputs.tag }}"
$Version = "${{ steps.get_version.outputs.version }}"
- $InstallerName = "mikusays-windows-inst-any-$Version.exe"
- gh release upload $TAG $InstallerName --clobber
+ $UploadName = "mikusays-windows-inst-any-$Version.exe"
+ gh release upload $TAG $UploadName --clobber
diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml
index c02a35b..af63b95 100644
--- a/.github/workflows/package.yml
+++ b/.github/workflows/package.yml
@@ -54,6 +54,8 @@ jobs:
ARCH_NAME="${{ matrix.deb_arch }}"
if [ "$ARCH_NAME" = "amd64" ]; then ARCH_NAME="x64"; fi
DEB_NAME="mikusays-debian-${ARCH_NAME}-${VERSION}.deb"
+ # Store version for later use
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "name=$DEB_NAME" >> $GITHUB_OUTPUT
- name: Upload DEB artifact
@@ -83,7 +85,7 @@ jobs:
with:
upload_url: ${{ steps.get-release.outputs.upload_url }}
asset_path: ${{ steps.find-deb.outputs.path }}
- asset_name: ${{ steps.find-deb.outputs.name }}
+ asset_name: mikusays-debian-${{ matrix.arch }}-${{ steps.find-deb.outputs.version }}.deb
asset_content_type: application/vnd.debian.binary-package
build-rpm:
@@ -140,6 +142,8 @@ jobs:
ARCH_NAME="${{ matrix.rpm_arch }}"
if [ "$ARCH_NAME" = "x86_64" ]; then ARCH_NAME="x64"; fi
RPM_NAME="mikusays-redhat-${ARCH_NAME}-${VERSION}.rpm"
+ # Store version for later use
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "name=$RPM_NAME" >> $GITHUB_OUTPUT
- name: Upload RPM artifact
@@ -169,5 +173,5 @@ jobs:
with:
upload_url: ${{ steps.get-release.outputs.upload_url }}
asset_path: ${{ steps.find-rpm.outputs.path }}
- asset_name: ${{ steps.find-rpm.outputs.name }}
+ asset_name: mikusays-redhat-${{ matrix.arch }}-${{ steps.find-rpm.outputs.version }}.rpm
asset_content_type: application/x-rpm
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index dfc3e88..63728cf 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -9,9 +9,43 @@ permissions:
contents: write
jobs:
+ extract-version:
+ name: Extract Version
+ runs-on: ubuntu-latest
+ outputs:
+ version: ${{ steps.get_version.outputs.version }}
+ version_valid: ${{ steps.validate_version.outputs.valid }}
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Get version from Cargo.toml
+ id: get_version
+ run: |
+ VERSION=$(grep '^version =' Cargo.toml | sed -E 's/version = "([^"]+)"/\1/')
+ echo "Extracted version: $VERSION"
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+
+ - name: Validate SemVer
+ id: validate_version
+ run: |
+ VERSION=${{ steps.get_version.outputs.version }}
+ # Comprehensive SemVer validation regex
+ # Supports: MAJOR.MINOR.PATCH-PRERELEASE+BUILD
+ # Where PRERELEASE can be: alpha, beta, rc.1, etc.
+ # Where BUILD can be: build.123, sha.abc123, etc.
+ if [[ ! $VERSION =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$ ]]; then
+ echo "Error: Version '$VERSION' is not a valid SemVer string"
+ echo "valid=false" >> $GITHUB_OUTPUT
+ exit 1
+ else
+ echo "Version '$VERSION' is valid SemVer"
+ echo "valid=true" >> $GITHUB_OUTPUT
+ fi
+
build-windows:
name: Build Windows
runs-on: windows-latest
+ needs: extract-version
strategy:
matrix:
target:
@@ -32,17 +66,18 @@ jobs:
run: |
mkdir artifacts
$arch = "${{ matrix.target }}".Split('-')[0]
- copy "target\${{ matrix.target }}\release\mikusays.exe" "artifacts\mikusays-windows-$arch.exe"
+ $version = "${{ needs.extract-version.outputs.version }}"
+ copy "target\${{ matrix.target }}\release\mikusays.exe" "artifacts\mikusays-windows-$arch-$version.exe"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mikusays-windows-${{ matrix.target }}
path: artifacts\*
-
build-linux:
name: Build Linux
runs-on: ubuntu-latest
+ needs: extract-version
strategy:
matrix:
include:
@@ -79,7 +114,8 @@ jobs:
- name: Prepare artifact
run: |
mkdir -p artifacts
- cp target/${{ matrix.target }}/release/mikusays artifacts/mikusays-linux-${{ matrix.arch }}
+ version="${{ needs.extract-version.outputs.version }}"
+ cp target/${{ matrix.target }}/release/mikusays artifacts/mikusays-linux-${{ matrix.arch }}-$version
chmod +x artifacts/mikusays-linux-${{ matrix.arch }}
- name: Upload artifact
@@ -87,10 +123,10 @@ jobs:
with:
name: mikusays-linux-${{ matrix.arch }}
path: artifacts/*
-
build-macos:
name: Build macOS
runs-on: macos-latest
+ needs: extract-version
strategy:
matrix:
include:
@@ -115,7 +151,8 @@ jobs:
- name: Prepare artifact
run: |
mkdir -p artifacts
- cp target/${{ matrix.target }}/release/mikusays artifacts/mikusays-macos-${{ matrix.arch }}
+ version="${{ needs.extract-version.outputs.version }}"
+ cp target/${{ matrix.target }}/release/mikusays artifacts/mikusays-macos-${{ matrix.arch }}-$version
chmod +x artifacts/mikusays-macos-${{ matrix.arch }}
- name: Upload artifact
@@ -127,8 +164,8 @@ jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
- needs: [build-windows, build-linux, build-macos]
- if: startsWith(github.ref, 'refs/tags/v')
+ needs: [extract-version, build-windows, build-linux, build-macos]
+ if: startsWith(github.ref, 'refs/tags/v') && needs.extract-version.outputs.version_valid == 'true'
steps:
- uses: actions/checkout@v4
@@ -144,7 +181,7 @@ jobs:
- name: Create Release
uses: softprops/action-gh-release@v1
with:
- files: artifacts/*
+ files: artifacts/mikusays-*
draft: false
prerelease: false
generate_release_notes: true
@@ -152,15 +189,15 @@ jobs:
## Downloads
### Windows
- - **x64**: `mikusays-windows-x86_64.exe`
- - **ARM64**: `mikusays-windows-aarch64.exe`
+ - **x64**: `mikusays-windows-x86_64-${{ needs.extract-version.outputs.version }}.exe`
+ - **ARM64**: `mikusays-windows-aarch64-${{ needs.extract-version.outputs.version }}.exe`
### Windows Installer
- **Any**: `mikusays-windows-inst-any.exe`
### Linux (binary)
- - **x64**: `mikusays-linux-x64`
- - **ARM64**: `mikusays-linux-arm64`
+ - **x64**: `mikusays-linux-x64-${{ needs.extract-version.outputs.version }}`
+ - **ARM64**: `mikusays-linux-arm64-${{ needs.extract-version.outputs.version }}`
### Debian Package
- **x64 Debian Package**: `mikusays-debian-x64.deb`
@@ -174,8 +211,8 @@ jobs:
Information on how to add it available here https://apt.xxanqw.pp.ua
### macOS
- - **Intel (x64)**: `mikusays-macos-x64`
- - **Apple Silicon (ARM64)**: `mikusays-macos-arm64`
+ - **Intel (x64)**: `mikusays-macos-x64-${{ needs.extract-version.outputs.version }}`
+ - **Apple Silicon (ARM64)**: `mikusays-macos-arm64-${{ needs.extract-version.outputs.version }}`
## Usage
```bash