chore: Update log file paths and initialize log in main.rs #16
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: auto_release | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
permissions: | |
contents: write | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
all: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set outputs | |
id: vars | |
run: echo "sha_short=$(git rev-parse --short=8 HEAD)" >> $GITHUB_OUTPUT | |
- name: build | |
run: | | |
cargo build --release | |
cp target/release/dnat target/release/dnat_gnu; | |
- name: build_musl | |
id: build_musl | |
uses: arloor/rust_musl_action@v2 | |
- name: mv_musl_bin | |
run: | | |
# 如果target/release/不存在,则创建该文件夹 | |
if [ ! -d "target/release/" ]; then | |
mkdir -p target/release/ | |
fi | |
cp ${{ steps.build_musl.outputs.release_dir }}dnat target/release/dnat; | |
- name: gihub release | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
version='1.0.0' | |
if $(gh release delete v${version} -y --cleanup-tag); | |
then echo "delete old release"; | |
else echo "no old release"; | |
fi | |
git config --local user.email "[email protected]" | |
git config --local user.name "arloor" | |
gh release create v${version} target/release/dnat target/release/dnat_gnu -n "$version" -t "$version" --latest |