Skip to content

Commit

Permalink
format and action
Browse files Browse the repository at this point in the history
  • Loading branch information
liuganghuan committed Jan 5, 2024
1 parent 76e94ad commit 9de1216
Show file tree
Hide file tree
Showing 12 changed files with 313 additions and 320 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: auto_release

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

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_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
env:
GH_TOKEN: ${{ github.token }}
run: |
if $(gh release delete v1.0.0 -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"
# git tag -f v1.0.0 -m 'latest'
# git push --force origin v1.0.0
gh release create v1.0.0 target/release/dnat -n "latest" --latest -t latest --target master
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"unwantedRecommendations": [
"ms-vscode-remote.remote-containers",
"ms-azuretools.vscode-docker"
],
"recommendations": []
}
20 changes: 20 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// 使用 IntelliSense 了解相关属性。
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug",
"program": "${workspaceFolder}/target/debug/dnat",
"args": ["nat.conf"],
"cwd": "${workspaceFolder}",
"preLaunchTask": "rust: cargo build",
"env": {
"HOSTNAME":"test"
}
}
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"github-actions.workflows.pinned.workflows": [
".github/workflows/release.yml"
]
}
17 changes: 17 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "cargo",
"command": "build",
"problemMatcher": [
"$rustc"
],
"group": {
"kind": "build"

},
"label": "rust: cargo build"
}
]
}
Loading

0 comments on commit 9de1216

Please sign in to comment.