Bump robinraju/release-downloader from 1.8 to 1.9 #625
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'dev' | |
paths-ignore: | |
- 'README.md' | |
- 'LICENSE' | |
pull_request: | |
branches: | |
- 'main' | |
- 'dev' | |
paths-ignore: | |
- 'README.md' | |
- 'LICENSE' | |
release: | |
types: | |
- 'prereleased' | |
- 'published' | |
- 'released' | |
# For test | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
RUST_BACKTRACE: 1 | |
jobs: | |
build: | |
timeout-minutes: 30 | |
env: | |
CARGO_TERM_COLOR: always | |
PROTOC_NO_VENDOR: true | |
name: '${{ matrix.config.name }}' | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Windows-x86_64", artifact: "Windows-x86_64", | |
os: windows-latest, | |
has_release: true, | |
rust: stable-x86_64-msvc, | |
target_triple: x86_64-pc-windows-msvc | |
} | |
- { | |
name: "Linux", artifact: "Linux-x86_64", | |
os: ubuntu-latest, | |
has_release: true, | |
rust: stable, | |
target_triple: x86_64-unknown-linux-gnu | |
} | |
- { | |
name: "macOS-x64", artifact: "macOS-x64", | |
os: macos-latest, | |
rust: stable, | |
has_release: true, | |
target_triple: x86_64-apple-darwin | |
} | |
steps: | |
- name: Set up NASM | |
uses: ilammy/setup-nasm@v1.4.0 | |
- uses: actions/checkout@v4 | |
- name: macOS - Build preparation - Install Packages | |
if: matrix.config.os == 'macos-latest' | |
run: | | |
brew install coreutils | |
- name: Install Rust (rustup) | |
run: rustup update ${{ matrix.config.rust }} --no-self-update && rustup default ${{ matrix.config.rust }} | |
shell: bash | |
- run: rustup target add ${{ matrix.config.target_triple }} | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get rust version | |
id: rust-version | |
run: echo "version=$(rustc --version)" >> $GITHUB_OUTPUT | |
- name: Cache cargo index | |
uses: actions/cache@v3.3.2 | |
with: | |
path: ~/.cargo/registry/index | |
key: index-${{ runner.os }}-${{ github.run_number }} | |
restore-keys: | | |
index-${{ runner.os }}- | |
# - name: Create lockfile | |
# run: cargo generate-lockfile | |
- name: Cache cargo registry | |
uses: actions/cache@v3.3.2 | |
with: | |
path: ~/.cargo/registry/cache | |
key: registry-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} | |
- name: Fetch dependencies | |
run: cargo fetch | |
- name: Cache target directory | |
uses: actions/cache@v3.3.2 | |
with: | |
path: target | |
key: cache-target-${{ runner.os }}-${{ steps.rust-version.outputs.version }}-${{ hashFiles('Cargo.lock') }} | |
- name: Build | |
shell: bash | |
run: | | |
cargo build --release --target=${{matrix.config.target_triple}} | |
- name: Run tests | |
shell: bash | |
run: | | |
cargo test --release --target=${{matrix.config.target_triple}} | |
- uses: robinraju/release-downloader@v1.9 | |
with: | |
repository: "v2fly/geoip" | |
latest: true | |
fileName: "geoip.dat" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: robinraju/release-downloader@v1.9 | |
with: | |
repository: "v2fly/geoip" | |
latest: true | |
fileName: "geoip.dat.sha256sum" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: robinraju/release-downloader@v1.9 | |
with: | |
repository: "v2fly/domain-list-community" | |
latest: true | |
fileName: "dlc.dat.sha256sum" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: robinraju/release-downloader@v1.9 | |
with: | |
repository: "v2fly/domain-list-community" | |
latest: true | |
fileName: "dlc.dat" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add geoip,geosite to release | |
shell: bash | |
run: | | |
mkdir release-tmp | |
cp ${GITHUB_WORKSPACE}/README.md ./release-tmp/README.md | |
cp ${GITHUB_WORKSPACE}/LICENSE ./release-tmp/LICENSE | |
cat dlc.dat.sha256sum | sha256sum --check --status | |
cat geoip.dat.sha256sum | sha256sum --check --status | |
mv dlc.dat ./release-tmp/geosite.dat | |
mv geoip.dat ./release-tmp/ | |
cp ./target/${{matrix.config.target_triple}}/release/v2ray-rust ./release-tmp/ | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: v2ray-rust-${{ github.sha }}-${{ matrix.config.artifact }}.7z | |
path: release-tmp | |
- name: Get the version | |
if: github.event_name == 'release' && matrix.config.has_release | |
id: get_version | |
run: echo VERSION=$(echo $GITHUB_REF | cut -d / -f 3) >> $GITHUB_OUTPUT | |
- name: Upload to GitHub Release | |
uses: svenstaro/upload-release-action@v2 | |
if: github.event_name == 'release' && matrix.config.has_release | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: v2ray-rust.7z | |
asset_name: v2ray-rust-${{ steps.get_version.outputs.VERSION }}-${{ matrix.config.artifact }}.7z | |
tag: ${{ github.ref }} | |
overwrite: true |