feat(release): setup release management with SemVer, packaging script, and Gitea CI/CD
Sanctum Release / Build & Release (Windows x86_64) (push) Canceled after 0s
Sanctum Release / Build & Release (Windows x86_64) (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
name: Sanctum Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build & Release (Windows x86_64)
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: x86_64-pc-windows-msvc
|
||||
|
||||
- name: Run Tests
|
||||
run: cargo test --all --verbose
|
||||
|
||||
- name: Build Release Binary
|
||||
run: cargo build --release
|
||||
|
||||
- name: Package Artifacts
|
||||
id: package
|
||||
shell: pwsh
|
||||
run: |
|
||||
$Tag = "${{ gitea.ref_name }}"
|
||||
$DistDir = "dist"
|
||||
$PackageName = "sanctum-${Tag}-windows-x86_64"
|
||||
$StagingDir = "${DistDir}/${PackageName}"
|
||||
$ZipFile = "${DistDir}/${PackageName}.zip"
|
||||
|
||||
New-Item -ItemType Directory -Path $StagingDir -Force | Out-Null
|
||||
Copy-Item "target/release/sanctum.exe" "$StagingDir/"
|
||||
Copy-Item "README.md" "$StagingDir/"
|
||||
Copy-Item "LICENSE" "$StagingDir/"
|
||||
Copy-Item "CHANGELOG.md" "$StagingDir/"
|
||||
|
||||
Compress-Archive -Path "$StagingDir/*" -DestinationPath $ZipFile -Force
|
||||
|
||||
$ZipHash = (Get-FileHash -Path $ZipFile -Algorithm SHA256).Hash.ToLower()
|
||||
$ExeHash = (Get-FileHash -Path "target/release/sanctum.exe" -Algorithm SHA256).Hash.ToLower()
|
||||
|
||||
@("$ZipHash ${PackageName}.zip", "$ExeHash sanctum.exe") | Set-Content -Path "${DistDir}/SHA256SUMS.txt" -Encoding utf8
|
||||
|
||||
|
||||
echo "ZIP_FILE=$ZipFile" >> $env:GITHUB_OUTPUT
|
||||
echo "PACKAGE_NAME=$PackageName" >> $env:GITHUB_OUTPUT
|
||||
|
||||
- name: Create Gitea Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: |
|
||||
dist/*.zip
|
||||
dist/SHA256SUMS.txt
|
||||
target/release/sanctum.exe
|
||||
body_path: CHANGELOG.md
|
||||
draft: false
|
||||
prerelease: false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user