hysteria/.github/workflows/release.yml

83 lines
2.6 KiB
YAML

name: Build and release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build and release
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- name: Check out
uses: actions/checkout@v3
- name: Get tag
uses: olegtarasov/get-tag@v2
id: tagName
- name: Get time
uses: gerred/actions/current-time@master
id: current-time
- name: Build (tun)
uses: crazy-max/ghaction-xgo@v1.6.1
env:
TIME: "${{ steps.current-time.outputs.time }}"
with:
xgo_version: latest
go_version: 1.17
dest: dist
prefix: hysteria-tun
targets: linux/amd64,linux/386,linux/arm-5,linux/arm-7,linux/arm64,linux/s390x,linux/mipsle,darwin-10.12/amd64,darwin-10.12/arm64,windows-6.0/amd64,windows-6.0/386
ldflags: -w -s -X main.appVersion=${{ env.GIT_TAG_NAME }} -X main.appCommit=${{ github.sha }} -X main.appDate=${{ env.TIME }}
pkg: cmd
- name: Build (notun)
uses: tobyxdd/go-cross-build@21e6b202e20aea08df331ea747dc9c266b420db8
env:
TIME: "${{ steps.current-time.outputs.time }}"
CGO_ENABLED: "0"
with:
name: hysteria
dest: dist
ldflags: -w -s -X main.appVersion=${{ env.GIT_TAG_NAME }} -X main.appCommit=${{ github.sha }} -X main.appDate=${{ env.TIME }}
platforms: 'linux/amd64, linux/386, linux/arm, linux/arm64, linux/s390x, linux/mipsle'
package: cmd
compress: false
- name: Generate hashes
run: |
cd dist
for f in $(find . -type f); do
sha256sum $f >> hashes.txt
done
- name: Upload
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./dist/hysteria-tun-linux-amd64
./dist/hysteria-tun-linux-386
./dist/hysteria-tun-linux-arm-5
./dist/hysteria-tun-linux-arm-7
./dist/hysteria-tun-linux-arm64
./dist/hysteria-tun-linux-s390x
./dist/hysteria-tun-linux-mipsle
./dist/hysteria-tun-darwin-10.12-amd64
./dist/hysteria-tun-darwin-10.12-arm64
./dist/hysteria-tun-windows-6.0-amd64.exe
./dist/hysteria-tun-windows-6.0-386.exe
./dist/hysteria-linux-amd64
./dist/hysteria-linux-386
./dist/hysteria-linux-arm
./dist/hysteria-linux-arm64
./dist/hysteria-linux-mipsle
./dist/hashes.txt