wireguard-ui/.github/workflows/release.yml

68 lines
1.9 KiB
YAML
Raw Normal View History

2020-05-21 18:27:53 +02:00
name: wireguard-ui build release
2020-05-21 15:48:07 +02:00
on:
release:
types: [created]
2020-05-21 12:29:09 +02:00
jobs:
2020-05-21 15:48:07 +02:00
releases-matrix:
name: Release Go Binary
2020-05-21 12:29:09 +02:00
runs-on: ubuntu-latest
2020-05-21 15:48:07 +02:00
strategy:
matrix:
2020-05-21 17:01:27 +02:00
# build and publish in parallel: linux/386, linux/amd64, darwin/386, darwin/amd64
2020-05-22 08:49:13 +02:00
goos: [linux, freebsd, darwin]
goarch: [386, amd64, arm, arm64]
exclude:
- goarch: 386
goos: darwin
- goarch: arm
goos: darwin
- goarch: arm64
goos: darwin
goarm:
- 7
2020-05-21 12:29:09 +02:00
steps:
2020-05-21 15:48:07 +02:00
# get the source code
- uses: actions/checkout@v2
# set environment
- name: Set APP_VERSION env
2021-08-05 20:46:23 +02:00
run: echo "APP_VERSION=$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev )" >> $GITHUB_ENV
2020-05-21 15:48:07 +02:00
- name: Set BUILD_TIME env
2021-08-05 20:46:23 +02:00
run: echo "BUILD_TIME=$(date)" >> $GITHUB_ENV
2020-05-21 15:48:07 +02:00
- name: Environment Printer
uses: managedkaos/print-env@v1.0
2020-05-21 17:01:27 +02:00
# setup node
2021-08-28 15:41:56 +02:00
- uses: actions/setup-node@v2
2020-05-21 15:48:07 +02:00
with:
2021-08-28 15:41:56 +02:00
node-version: '14'
2020-05-21 17:01:27 +02:00
registry-url: 'https://registry.npmjs.org'
2020-05-21 15:48:07 +02:00
2020-05-21 17:01:27 +02:00
# prepare assets for go rice
- name: Prepare assets
2020-05-21 16:49:00 +02:00
run: |
chmod +x ./prepare_assets.sh
./prepare_assets.sh
2020-05-21 15:48:07 +02:00
2020-05-21 18:17:33 +02:00
# get go rice tool
2020-05-21 18:27:53 +02:00
- name: Get go rice tool
2020-05-21 18:17:33 +02:00
run: go get github.com/GeertJohan/go.rice/rice
# run go rice embed
2020-05-21 18:27:53 +02:00
- name: Run go rice embed
2020-05-21 18:17:33 +02:00
run: ${HOME}/go/bin/rice embed-go
2020-05-21 15:48:07 +02:00
# build and make the releases
2020-05-21 18:27:53 +02:00
- name: Build and make the releases
2020-05-21 18:17:33 +02:00
uses: wangyoucao577/go-release-action@master
2020-05-21 15:48:07 +02:00
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
2021-08-28 15:41:56 +02:00
goversion: "https://dl.google.com/go/go1.16.1.linux-amd64.tar.gz"
2020-05-21 15:48:07 +02:00
binary_name: "wireguard-ui"
build_flags: -v
ldflags: -X "main.appVersion=${{ env.APP_VERSION }}" -X "main.buildTime=${{ env.BUILD_TIME }}" -X main.gitCommit=${{ github.sha }} -X main.gitRef=${{ github.ref }}