Skip to content

修改:动态获取自动化构建正确架构的 upx #31

修改:动态获取自动化构建正确架构的 upx

修改:动态获取自动化构建正确架构的 upx #31

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*' # Trigger on tags that start with 'v'
jobs:
build-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22.1' # Adjust to your desired Go version
- name: Cache Go modules
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: "${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}"
restore-keys: |
${{ runner.os }}-go-
- name: Install Build Tools
run: |
apt update && apt install -y zip
arch=$(uname -m)
case $arch in
x86_64)
arch="amd64"
;;
aarch64)
arch="arm64"
;;
armv*)
arch="arm"
;;
i?86)
arch="i386"
;;
*)
echo "unsupported architecture"
exit 1
;;
esac
latest_version=$(curl -s https://api.github.com/repos/upx/upx/releases/latest | grep -o '"tag_name": "v.*"' | cut -d'"' -f4)
download_url="https://github.com/upx/upx/releases/download/${latest_version}/upx-${latest_version#v}-${arch}_linux.tar.xz"
curl -L -o upx.tar.xz $download_url
tar -xJf upx.tar.xz
mv upx-*-${arch}_linux/upx /usr/local/bin/
- name: Build and Release
env:
NAME: connect_jxyy_network # Adjust the project name
BINDIR: bin
run: |
make releases
cp config_example.yaml bin/config.yaml
- name: Upload Release
uses: softprops/action-gh-release@v1
with:
files: bin/*
draft: true
token: ${{ secrets.GHCR_PAT }} # Use a GitHub Personal Access Token