Skip to content

Commit

Permalink
Update build_release.yml and Cargo.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
rabilrbl committed Feb 8, 2024
1 parent da8a481 commit ff53160
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 32 deletions.
47 changes: 15 additions & 32 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,60 +14,43 @@ env:
jobs:
native-build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl

# - os: windows-latest
# target: x86_64-pc-windows-msvc
# extension: .exe

# - os: windows-latest
# target: i686-pc-windows-msvc
# extension: .exe

# - os: windows-latest
# target: aarch64-pc-windows-msvc
# extension: .exe

# - os: macos-latest
# target: x86_64-apple-darwin

# - os: macos-latest
# target: aarch64-apple-darwin

env:
TARGET: x86_64-unknown-linux-musl
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust
run: |
rustup update --no-self-update stable
rustup target add ${{ matrix.target }}
rustup target add ${{ env.TARGET }}
rustup default stable
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install musl-tools -y
- name: Setup Cache
uses: Swatinem/rust-cache@v2
env:
cache-name: cache-cargo-${{ matrix.target }}
cache-name: cache-cargo-${{ env.TARGET }}
with:
prefix-key: "prevanced-backend-v1"
shared-key: ${{ runner.os }}-cargo-
key: ${{ runner.os }}-cargo-${{ matrix.target }}-
key: ${{ runner.os }}-cargo-${{ env.TARGET }}-
cache-directories: |
C:\Users\runneradmin\.cargo
/Users/runner/.cargo
- name: Build for ${{ matrix.target }}
run: cargo build --release --target ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ env.TARGET }}

- name: Upload binaries to release
if: ${{ github.event_name == 'release' }}
run: |
mv target/${{ matrix.target }}/release/prevanced-backend target/${{ matrix.target }}/release/prevanced-backend-${{ github.ref_name }}
gh release upload ${{ github.ref_name }} target/${{ matrix.target }}/release/prevanced-backend-${{ github.ref_name }}
mv target/${{ env.TARGET }}/release/prevanced-backend target/${{ env.TARGET }}/release/prevanced-backend-${{ github.ref_name }}
gh release upload ${{ github.ref_name }} target/${{ env.TARGET }}/release/prevanced-backend-${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -86,4 +69,4 @@ jobs:
mv temp_Dockerfile Dockerfile
git add Dockerfile
git commit -m "Update prevanced-backend to ${{ github.ref_name }}"
git push origin main
git push origin main
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name = "prevanced-backend"
version = "0.1.0"
edition = "2021"


[dependencies]
axum = "0.7"
axum-extra = { version = "0.9.2", features = ["typed-header"] }
Expand Down

0 comments on commit ff53160

Please sign in to comment.