Simplify entrpoints. #20
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: Make a release | |
on: | |
push: | |
tags: | |
- v*.*.* | |
jobs: | |
test_and_build: | |
strategy: | |
matrix: | |
go-version: [1.20.x] | |
arch: [linux_amd64, windows_amd64, darwin_amd64, darwin_arm64] | |
runs-on: ubuntu-latest | |
env: | |
GOPATH: /tmp/go | |
GOARCH: | |
steps: | |
- name: create Go path | |
run: | | |
mkdir -p /tmp/go | |
- name: install Golang | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{matrix.go-version}} | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Extract version | |
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: run tests | |
if: ${{ matrix.arch == 'linux-amd64' }} # we only run the tests on Linux | |
run: | | |
export GOARCH=`echo ${{matrix.arch}} | sed 's/[a-z0-9]*_//g'` | |
export GOOS=`echo ${{matrix.arch}} | sed 's/\([a-z0-9]*\)_[a-z0-9]*$/\1/g'` | |
make certs | |
make test | |
- name: build binaries | |
run: | | |
export GOARCH=`echo ${{matrix.arch}} | sed 's/[a-z0-9]*_//g'` | |
export GOOS=`echo ${{matrix.arch}} | sed 's/\([a-z0-9]*\)_[a-z0-9]*$/\1/g'` | |
make | |
- name: Upload binaries (Linux) | |
if: ${{ matrix.arch == 'linux_amd64' }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: hyper-${{matrix.arch}} | |
path: | | |
/tmp/go/bin/* | |
- name: Upload binaries (all other) | |
if: ${{ matrix.arch != 'linux_amd64' }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: hyper-${{matrix.arch}} | |
path: | | |
/tmp/go/bin/${{matrix.arch}}/* | |
- name: rename binaries for non-Linux platforms | |
if: ${{ matrix.arch != 'linux_amd64' && matrix.arch != 'windows_amd64' }} | |
run: | | |
mv /tmp/go/bin/${{matrix.arch}}/hyper /tmp/go/bin/${{matrix.arch}}/hyper-${{matrix.arch}} | |
mv /tmp/go/bin/${{matrix.arch}}/sd /tmp/go/bin/${{matrix.arch}}/sd-${{matrix.arch}} | |
mv /tmp/go/bin/${{matrix.arch}}/proxy /tmp/go/bin/${{matrix.arch}}/proxy-${{matrix.arch}} | |
- name: rename binaries for non-Linux platforms | |
if: ${{ matrix.arch == 'windows_amd64' }} | |
run: | | |
mv /tmp/go/bin/${{matrix.arch}}/hyper.exe /tmp/go/bin/${{matrix.arch}}/hyper-${{matrix.arch}}.exe | |
mv /tmp/go/bin/${{matrix.arch}}/sd.exe /tmp/go/bin/${{matrix.arch}}/sd-${{matrix.arch}}.exe | |
mv /tmp/go/bin/${{matrix.arch}}/proxy.exe /tmp/go/bin/${{matrix.arch}}/proxy-${{matrix.arch}}.exe | |
- name: Upload binaries to release page | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
/tmp/go/bin/*/* | |
/tmp/go/bin/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |