ci: add Gitea Actions workflow for multi-platform releases
This commit is contained in:
97
.gitea/workflows/release.yaml
Normal file
97
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
name: Build and Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-linux:
|
||||||
|
name: Build Linux
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Rust
|
||||||
|
uses: actions/setup-rust@v1
|
||||||
|
with:
|
||||||
|
rust-version: stable
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cargo build --release
|
||||||
|
|
||||||
|
- name: Package Linux
|
||||||
|
run: |
|
||||||
|
mkdir -p dist-linux
|
||||||
|
cp target/release/dhl dist-linux/dhl
|
||||||
|
cp config.json.example dist-linux/config.json
|
||||||
|
cp response.json.example dist-linux/response.json
|
||||||
|
tar -czvf dhl-linux.tar.gz -C dist-linux .
|
||||||
|
|
||||||
|
- name: Upload Linux Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dhl-linux
|
||||||
|
path: dhl-linux.tar.gz
|
||||||
|
|
||||||
|
build-windows:
|
||||||
|
name: Build Windows
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Rust
|
||||||
|
uses: actions/setup-rust@v1
|
||||||
|
with:
|
||||||
|
rust-version: stable
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cargo build --release
|
||||||
|
|
||||||
|
- name: Package Windows
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
New-Item -ItemType Directory -Force -Path dist-windows
|
||||||
|
Copy-Item target/release/dhl.exe dist-windows/dhl.exe
|
||||||
|
Copy-Item config.json.example dist-windows/config.json
|
||||||
|
Copy-Item response.json.example dist-windows/response.json
|
||||||
|
Compress-Archive -Path dist-windows/* -DestinationPath dhl-windows.zip
|
||||||
|
|
||||||
|
- name: Upload Windows Artifact
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dhl-windows
|
||||||
|
path: dhl-windows.zip
|
||||||
|
|
||||||
|
create-release:
|
||||||
|
name: Create Release
|
||||||
|
needs: [build-linux, build-windows]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Download Linux Artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dhl-linux
|
||||||
|
path: .
|
||||||
|
|
||||||
|
- name: Download Windows Artifact
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: dhl-windows
|
||||||
|
path: .
|
||||||
|
|
||||||
|
- name: Create Gitea Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
dhl-linux.tar.gz
|
||||||
|
dhl-windows.zip
|
||||||
|
generate_release_notes: true
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
Reference in New Issue
Block a user