v1.2.2 #59
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Release | |
on: | |
release: | |
types: [prereleased, released, edited, published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x] | |
steps: | |
- name: Fetch Sources | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.tag_name }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: cd web && npm install --legacy-peer-deps && npm run build | |
- name: Mkdir | |
run: | | |
mkdir -p release/gshark_darwin_amd64 && mkdir -p release/gshark_windows_amd64 && | |
mkdir -p release/gshark_linux_amd64 | |
- name: Move config | |
run: | | |
cp ./server/config-temp.yaml ./release/gshark_darwin_amd64/ && cp ./server/config-temp.yaml ./release/gshark_windows_amd64/ && | |
cp ./server/config-temp.yaml ./release/gshark_linux_amd64/ | |
- name: Move resource | |
run: | | |
cp -rf ./server/resource ./release/gshark_darwin_amd64/ && cp -rf ./server/resource ./release/gshark_windows_amd64/ && | |
cp -rf ./server/resource ./release/gshark_linux_amd64/ | |
- name: Copy dist | |
run: | | |
cp -rf ./web/dist ./release/gshark_darwin_amd64/ && cp -rf ./web/dist ./release/gshark_windows_amd64/ && | |
cp -rf ./web/dist ./release/gshark_linux_amd64/ | |
- name: Go Setup | |
uses: actions/setup-go@v3.1.0 | |
- name: Go Build for darwin | |
env: | |
GO111MODULE: on | |
working-directory: ./server | |
run: | | |
go mod tidy && GOOS=darwin GOARCH=amd64 go build -o gshark && cp gshark ../release/gshark_darwin_amd64 | |
- name: Go build for darwin arm64 | |
env: | |
GO111MODULE: on | |
working-directory: ./server | |
run: | | |
go mod tidy && GOOS=darwim GOARCH=arm64 go build -o gshark && cp gshark ../release/gshark_darwin_arm64 | |
- name: Go Build for windows | |
env: | |
GO111MODULE: on | |
working-directory: ./server | |
run: | | |
go mod tidy && GOOS=windows GOARCH=amd64 go build && cp gshark.exe ../release/gshark_windows_amd64 | |
- name: Go Build for linux | |
env: | |
GO111MODULE: on | |
working-directory: ./server | |
run: | | |
go mod tidy && GOOS=linux GOARCH=amd64 go build -o gshark && cp gshark ../release/gshark_linux_amd64 | |
- name: Compress | |
run: | | |
7z a -r ./release/gshark_darwin_amd64.zip ./release/gshark_darwin_amd64/ && | |
7z a -r ./release/gshark_windows_amd64.zip ./release/gshark_windows_amd64/ && | |
7z a -r ./release/gshark_linux_amd64.zip ./release/gshark_linux_amd64/ && | |
7z a -r ./release/gshark_darwin_arm64.zip ./release/gshark_darwin_arm64 | |
- name: Remove release directory | |
run: | | |
rm -rf release/gshark_*/ | |
- name: Upload Release Asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release upload ${{ github.event.release.tag_name }} ./release/* | |