52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
name: Cargo Build & Test
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
|
|
jobs:
|
|
build_latest:
|
|
name: Build - ubuntu-latest
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
|
|
- run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
- run: rustup update 1.90 && rustup default 1.90
|
|
- run: cargo build
|
|
- run: cargo build --release
|
|
- name: Get version
|
|
run: |
|
|
echo "PROJECT_VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" >> $GITHUB_ENV
|
|
- name: Rename binary
|
|
run: mv target/release/gitea_mirror target/release/gitea_mirror-${{ env.PROJECT_VERSION }}-ubuntu-latest
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v2
|
|
if: github.ref_type == 'tag'
|
|
with:
|
|
files: target/release/gitea_mirror-${{ env.PROJECT_VERSION }}-ubuntu-latest
|
|
|
|
build_legacy:
|
|
name: Build - ubuntu-22.04
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
|
|
- run: echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
- run: rustup update 1.90 && rustup default 1.90
|
|
- run: cargo build
|
|
- run: cargo build --release
|
|
- name: Get version
|
|
run: |
|
|
echo "PROJECT_VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)" >> $GITHUB_ENV
|
|
- name: Rename binary
|
|
run: mv target/release/gitea_mirror target/release/gitea_mirror-${{ env.PROJECT_VERSION }}-ubuntu-22.04
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v2
|
|
if: github.ref_type == 'tag'
|
|
with:
|
|
files: target/release/gitea_mirror-${{ env.PROJECT_VERSION }}-ubuntu-22.04
|