修改:尝试适配 Mac M2 #28
Workflow file for this run
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: 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 UPX | |
run: | | |
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}-amd64_linux.tar.xz" | |
curl -L -o upx.tar.xz $download_url | |
tar -xJf upx.tar.xz | |
mv upx-*-amd64_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 |