-
Notifications
You must be signed in to change notification settings - Fork 6
65 lines (65 loc) · 2.66 KB
/
standard.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: build_standard
on:
push:
branches: [ "**"]
pull_request:
branches: [ "master" ]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
standard:
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
id: build
uses: arloor/rust_musl_action@latest
with:
use_musl: false
extra_deps: cmake
args: -p rust_http_proxy --no-default-features --features aws_lc_rs
apt_mirror: mirrors.mit.edu
rust_flags: -C target-feature=+crt-static
- name: docker build and push
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
ls -lh ${{ steps.build.outputs.release_dir }}
dockerfile="Dockerfile.static"
podman build -f ${dockerfile} . -t docker.io/arloor/rust_http_proxy:latest --build-arg TARGET_PATH=/x86_64-unknown-linux-gnu
podman login docker.io -u arloor -p ${{ secrets.REGISTRY_PASSWORD }}
# podman push docker.io/arloor/rust_http_proxy:${{ steps.vars.outputs.sha_short }}
podman push docker.io/arloor/rust_http_proxy:latest
- name: create master release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GH_TOKEN: ${{ github.token }}
run: |
version=latest
if $(gh release delete ${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 ${version} ${{ steps.build.outputs.release_dir }}rust_http_proxy -n "$version" --latest -t "$version"
- name: create version release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')
env:
GH_TOKEN: ${{ github.token }}
run: |
# 从Cargo.toml中提取版本号
version=$(grep -E ^version rust_http_proxy/Cargo.toml|awk -F "[\"]" '{print $2}')
version="v${version}"
if [ -z "$version" ]; then echo "version not found"; exit 1; fi
if $(gh release delete ${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 ${version} ${{ steps.build.outputs.release_dir }}rust_http_proxy -n "$version" --latest -t "$version"