Refactor reverse proxy configuration to include libbpf-dev and libelf… #1084
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: [ "**"] | |
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" | |
bpf: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: build bpf | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
id: build_bpf | |
uses: arloor/rust_musl_action@latest | |
with: | |
use_musl: false | |
extra_deps: cmake zlib1g-dev libelf-dev libbpf-dev | |
after_install: | | |
find / -name libelf.a | |
find / -name libbpf.a | |
find / -name libz.a | |
export LIBBPF_SYS_LIBRARY_PATH=/usr/lib:/usr/lib64:/usr/lib/x86_64-linux-gnu | |
echo -e "\e[31mLIBBPF_SYS_LIBRARY_PATH=$LIBBPF_SYS_LIBRARY_PATH\e[0m" | |
args: -p rust_http_proxy --no-default-features --features aws_lc_rs,bpf_static | |
apt_mirror: mirrors.mit.edu | |
rust_flags: -C target-feature=+crt-static | |
debug: false | |
- name: docker build and push | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
run: | | |
ls -lh ${{ steps.build_bpf.outputs.release_dir }} | |
dockerfile="Dockerfile.static" | |
podman build -f ${dockerfile} . -t docker.io/arloor/rust_http_proxy:bpf --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:bpf | |
- name: create bpf release | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
version='bpf' | |
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_bpf.outputs.release_dir }}rust_http_proxy -n "$version" -t "$version" --prerelease |