ci: migrate release build to GitHub Actions
- add .github/workflows/build.yml: native per-OS runners (ubuntu/macos/windows) build and attach archives to the GitHub Release via gh CLI with GITHUB_TOKEN - add workflow_dispatch to smoke-test builds without publishing a release - remove .gitea/workflows/build.yml (cargo-zigbuild + Gitea API upload no longer used) - docs: point clone and release URLs at github.com and update the Building section
This commit is contained in:
3 files changed
+67
-79
No files matched your search
@@ -0,0 +1,64 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch: # manual: build + package only (no version override, no upload)
|
||||
|
||||
permissions:
|
||||
contents: write # so GITHUB_TOKEN can upload assets to the release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: ${{ matrix.archive }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: x86_64-unknown-linux-gnu
|
||||
binary: ccsm
|
||||
archive: ccsm-linux-amd64.tar.gz
|
||||
- os: macos-latest
|
||||
target: x86_64-apple-darwin
|
||||
binary: ccsm
|
||||
archive: ccsm-darwin-amd64.tar.gz
|
||||
- os: windows-latest
|
||||
target: x86_64-pc-windows-msvc
|
||||
binary: ccsm.exe
|
||||
archive: ccsm-windows-amd64.zip
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Set version from release tag
|
||||
if: github.event_name == 'release'
|
||||
run: |
|
||||
VERSION="${GITHUB_REF_NAME#v}"
|
||||
echo "CCSM_VERSION=$VERSION" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Install Rust toolchain (+ target)
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Build release binary
|
||||
run: cargo build --release --target ${{ matrix.target }}
|
||||
|
||||
- name: Package archive
|
||||
shell: bash
|
||||
run: |
|
||||
cd "target/${{ matrix.target }}/release"
|
||||
if [[ "${{ runner.os }}" == 'Windows' ]]; then
|
||||
powershell -NoProfile -Command "Compress-Archive -Path '${{ matrix.binary }}' -DestinationPath '${{ matrix.archive }}' -Force"
|
||||
else
|
||||
tar czf "${{ matrix.archive }}" "${{ matrix.binary }}"
|
||||
fi
|
||||
|
||||
- name: Upload to GitHub release
|
||||
if: github.event_name == 'release'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: gh release upload "${{ github.event.release.tag_name }}" "target/${{ matrix.target }}/release/${{ matrix.archive }}" --clobber
|
||||
Reference in new issue
Block a user