This repository has been archived by the owner on May 15, 2024. It is now read-only.
add proxy key; #20
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
# This workflow will build a golang project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
name: Go | |
env: | |
TAG_NAME: "v3" | |
RELEASE_TITLE: "Transfer-server v3" | |
on: | |
push: | |
paths-ignore: | |
- "**/*.md" | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
env: | |
GO111MODULE: on | |
CGO_ENABLED: 0 | |
GOARCH: amd64 | |
GOOS: linux | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
- name: "check env" | |
run: | | |
mkdir build | |
go env | |
ls .. | |
- name: "[linux] Build and Compress executable" | |
run: | | |
go build -ldflags "-s -w" -v -o ./build/TServ | |
- name: "[linux] Compress executable" | |
run: | | |
curl -L https://github.com/upx/upx/releases/download/v4.1.0/upx-4.1.0-amd64_linux.tar.xz -o upx.tar.xz | |
tar -xvf upx.tar.xz | |
./upx-4.1.0-amd64_linux/upx -9 ./build/TServ -o ./build/TServ_upx | |
# - name: "[linux]Compress to gzip" | |
# run: | | |
# tar -zcvf ./build/TServ_amd64-linux.tar.gz ./build/TServ | |
# tar -zcvf ./build/TServ_amd64_upx-linux.tar.gz ./build/TServ_upx | |
- name: "[linux] Uplaod artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tserv-linux64 | |
path: | | |
./build/TServ | |
./build/TServ_upx | |
retention-days: 30 | |
windows: | |
runs-on: ubuntu-latest | |
env: | |
GO111MODULE: on | |
CGO_ENABLED: 0 | |
GOARCH: amd64 | |
GOOS: windows | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
- name: "check env" | |
run: | | |
mkdir build | |
go env | |
ls .. | |
- name: "[windows] Build and Compress executable" | |
run: | | |
go build -ldflags "-s -w" -v -o ./build/TServ.exe | |
- name: "[windows] Compress executable" | |
run: | | |
curl -L https://github.com/upx/upx/releases/download/v4.1.0/upx-4.1.0-amd64_linux.tar.xz -o upx.tar.xz | |
tar -xvf upx.tar.xz | |
./upx-4.1.0-amd64_linux/upx -9 ./build/TServ.exe -o ./build/TServ_upx.exe | |
# - name: Install zip | |
# uses: montudor/action-zip@v1 | |
# - name: Compress to zip | |
# run: | | |
# zip -qq ./build/TServ_amd64-windows.zip ./build/TServ.exe | |
# zip -qq ./build/TServ_amd64_upx-windows.zip ./build/TServ_upx.exe | |
- name: "[windows] Uplaod artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: tserv-windows64 | |
path: | | |
./build/TServ.exe | |
./build/TServ_upx.exe | |
retention-days: 30 | |
publish: | |
needs: [linux, windows] | |
runs-on: ubuntu-latest | |
env: | |
GH_REPO: ${{ github.repository }} | |
GH_TOKEN: ${{ secrets.RELEASE_TOKEN }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
- name: Install dependencies | |
run: sudo apt-get update && sudo apt-get install -y gettext-base | |
- name: Delete existing release | |
run: | | |
gh release delete $TAG_NAME --yes || true | |
- name: Create Release and Upload Release Asset | |
run: | | |
# envsubst < "$GITHUB_WORKSPACE/.github/workflows/release_note.md" > "$RUNNER_TEMP/notes.md" | |
gh release create $TAG_NAME --notes-file "./.github/workflows/release_note.md" --title "$RELEASE_TITLE" --target $GITHUB_SHA tserv-linux64/* tserv-windows64/* | |
# uses: softprops/action-gh-release@v1 | |
# with: | |
# tag_name: ${{ env.TAG_NAME }} | |
# name: ${{ env.RELEASE_TITLE }} | |
# body: ${{ steps.release_notes.outputs.release_notes }} | |
# draft: false | |
# prerelease: false | |
# token: ${{ secrets.RELEASE_TOKEN }} | |
# files: | | |
# ../TServ_amd64-linux.tar.gz | |
# ../TServ_amd64-windows.zip |