Basic Go implementation of SeedLink #56
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: Publish release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "*" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Node.js version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.14.0" | |
- name: Set up Golang version | |
uses: actions/setup-go@v4 | |
with: | |
go-version: stable | |
check-latest: true | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Build frontend dist | |
id: build_frontend | |
run: | | |
cd frontend/src | |
npm install | |
make | |
echo "::set-output name=status::success" | |
- name: Build Swagger docs | |
if: steps.build_frontend.outputs.status == 'success' | |
id: build_docs | |
run: | | |
go install github.com/swaggo/swag/cmd/swag@latest | |
cd docs | |
make | |
echo "::set-output name=status::success" | |
- name: Build backend release | |
id: build_release | |
if: steps.build_docs.outputs.status == 'success' | |
run: | | |
go mod download | |
cd build | |
make -j$(nproc) | |
echo "::set-output name=status::success" | |
- name: Package release binaries | |
id: package_release | |
if: steps.build_release.outputs.status == 'success' | |
run: | | |
mkdir -p ./build/release | |
for i in ./build/dist/*; do | |
arch=$(basename $i) | |
if [ "x$arch" != "xwin32" ] && [ "x$arch" != "xwin64" ]; then | |
echo "Packaging Linux $arch ..." | |
filename=./build/release/linux_$arch.zip | |
zip -rj $filename $i | |
elif [ "x$arch" == "xwin32" ]; then | |
echo "Packaging Windows 32-bit ..." | |
filename=./build/release/windows_386.zip | |
zip -rj $filename $i | |
elif [ "x$arch" == "xwin64" ]; then | |
echo "Packaging Windows 64-bit ..." | |
filename=./build/release/windows_amd64.zip | |
zip -rj $filename $i | |
fi | |
done | |
echo "::set-output name=status::success" | |
- name: "Create release digest" | |
id: create_digest | |
if: steps.package_release.outputs.status == 'success' | |
run: | | |
cd build/release | |
for i in *; do | |
echo "Creating digest for $i ..." | |
openssl dgst -md5 $i | sed 's/([^)]*)//g' >> $i.dgst | |
openssl dgst -sha1 $i | sed 's/([^)]*)//g' >> $i.dgst | |
openssl dgst -sha256 $i | sed 's/([^)]*)//g' >> $i.dgst | |
openssl dgst -sha512 $i | sed 's/([^)]*)//g' >> $i.dgst | |
done | |
echo "::set-output name=status::success" | |
- name: Upload packages to release | |
uses: svenstaro/upload-release-action@v2 | |
if: steps.create_digest.outputs.status == 'success' | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref }} | |
file: build/release/* | |
overwrite: true | |
file_glob: true | |
body: | | |
This release is automatically generated by GitHub Actions. | |
Please refer to [CHANGELOG.md](https://github.com/anyshake/observer/blob/master/CHANGELOG.md) for details. |