-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
11 additions
and
87 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,99 +1,18 @@ | ||
name: Build/publish release | ||
|
||
name: rust release action | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
create-release: | ||
if: (startsWith(github.ref_name, 'v') && github.ref_type == 'tag') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: taiki-e/create-gh-release-action@v1 | ||
with: | ||
title: $version | ||
token: ${{ secrets.GH_TOKEN }} | ||
|
||
release: | ||
name: Binary ${{ matrix.target }} (on ${{ matrix.os }}) | ||
continue-on-error: false | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
compress: true | ||
- os: ubuntu-latest | ||
target: aarch64-unknown-linux-gnu | ||
compress: true | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-linux-musl | ||
compress: true | ||
- os: ubuntu-latest | ||
target: aarch64-unknown-linux-musl | ||
compress: true | ||
- os: windows-latest | ||
compress: true | ||
- os: macos-latest | ||
target: x86_64-apple-darwin | ||
compress: true | ||
- os: macos-latest | ||
target: aarch64-apple-darwin | ||
compress: true | ||
- os: ubuntu-latest | ||
target: x86_64-unknown-freebsd | ||
compress: true | ||
|
||
# The type of runner that the job will run on | ||
# Runs on Ubuntu if other os is not specified above | ||
runs-on: ${{ matrix.os || 'ubuntu-latest' }} | ||
timeout-minutes: 90 | ||
permissions: | ||
contents: write | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: create version file | ||
if: (startsWith(github.ref_name, 'v') && github.ref_type == 'tag') | ||
run: echo "${{github.ref_name}}" | tail -c+2 >> .build_version | ||
|
||
- name: Get version from tag | ||
id: extract_version | ||
run: | | ||
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | ||
shell: bash | ||
|
||
- name: Setup Rust toolchain | ||
# uses: dtolnay/rust-toolchain@nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
override: true | ||
|
||
- run: sudo apt install musl-tools | ||
if: startsWith(matrix.os, 'ubuntu') | ||
|
||
- name: Install openssl on ubuntu if needed | ||
if: startsWith(matrix.os, 'ubuntu') | ||
run: grep -q 'openssl' 'Cargo.lock' && sudo apt install pkg-config libssl-dev || true | ||
- name: Install openssl on macos if needed | ||
if: startsWith(matrix.os, 'macos') | ||
run: grep -q 'openssl' 'Cargo.lock' && brew install openssl || true | ||
# - name: Set Perl environment variables | ||
# if: runner.os == 'Windows' | ||
# run: | | ||
# # choco install openssl strawberryperl | ||
# echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | ||
# echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 | ||
|
||
- name: Build and Upload | ||
uses: taiki-e/upload-rust-binary-action@v1 | ||
- name: test build rust project | ||
uses: lxl66566/rust-simple-release@main | ||
with: | ||
bin: git-se | ||
target: ${{ matrix.target }} | ||
tar: unix | ||
zip: windows | ||
targets: aarch64-unknown-linux-gnu, aarch64-unknown-linux-musl, x86_64-pc-windows-msvc, x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu, aarch64-apple-darwin, x86_64-apple-darwin | ||
token: ${{ secrets.GH_TOKEN }} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[toolchain] | ||
channel = "nightly" | ||
components = ["rustfmt", "clippy", "rust-src"] |