Skip to content

Go

Go #62

Workflow file for this run

name: Go
on:
create:
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up Go
uses: actions/setup-go@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
go-version: 1.21.8
- name: Download PRIVATE dependencies
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
GOPRIVATE: m7s.live/plugin/snappro/v4,m7s.live/plugin/transcode/v4,m7s.live/plugin/cascade,m7s.live/plugin/cdn,m7s.live/plugin/crypto,m7s.live/plugin/admin
CGO_ENABLED: 0
run: |
mkdir -p ~/.ssh bin
ssh-keyscan github.com >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.GO_MODULE_PRIVATE_KEY }}"
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
git clone --depth 1 [email protected]:Monibuca/plugin-admin
go mod tidy
go env
go build -o m7s -ldflags="-s -w -X main.version=${GITHUB_REF:11}" main.go
tar -zcvf bin/m7s_linux_amd64.tar.gz m7s conf
mv m7s plugin-admin/apps/gb28181/src-tauri/m7s-x86_64-unknown-linux-gnu
go env -w GOOS=windows
go build -o m7s.exe -ldflags="-s -w -X main.version=${GITHUB_REF:11}" main.go
zip bin/m7s_windows_amd64.zip m7s.exe conf
mv m7s.exe plugin-admin/apps/gb28181/src-tauri/m7s-x86_64-pc-windows-msvc.exe
go env -w GOOS=darwin
go build -o m7s -ldflags="-s -w -X main.version=${GITHUB_REF:11}" main.go
tar -zcvf bin/m7s_darwin_amd64.tar.gz m7s conf
mv m7s plugin-admin/apps/gb28181/src-tauri/m7s-x86_64-apple-darwin
go env -w GOARCH=arm64
go build -o m7s -ldflags="-s -w -X main.version=${GITHUB_REF:11}" main.go
tar -zcvf bin/m7s_darwin_arm64.tar.gz m7s conf
mv m7s plugin-admin/apps/gb28181/src-tauri/m7s-aarch64-apple-darwin
go env -w GOOS=linux
go build -o m7s -ldflags="-s -w -X main.version=${GITHUB_REF:11}" main.go
tar -zcvf bin/m7s_linux_arm64.tar.gz m7s conf
- name: R2 Release
uses: shallwefootball/[email protected]
with:
aws_key_id: ${{ secrets.R2_KEY }}
aws_secret_access_key: ${{ secrets.R2_SECRET }}
aws_bucket: monibuca
source_dir: bin
destination_dir: pro
endpoint: https://${{ secrets.R2_DOMAIN }}
# - name: Upload Artifact
# uses: actions/upload-artifact@v4
# with:
# name: binaries
# path: plugin-admin
# build-tauri-windows:
# needs: build
# runs-on: windows-latest
# steps:
# - name: setup node
# uses: actions/setup-node@v3
# with:
# node-version: 18
# - name: install Rust stable windows
# uses: actions-rs/toolchain@v1
# with:
# default: true
# override: true
# profile: minimal
# toolchain: stable
# target: x86_64-pc-windows-msvc
# - name: Download Artifact
# uses: actions/download-artifact@v4
# with:
# name: binaries
# - uses: JonasKruckenberg/tauri-build@v1
# id: tauri_build
# env:
# TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
# with:
# target: x86_64-pc-windows-msvc
# projectPath: apps/gb28181/src-tauri
# debug: true
# - name: copy ouputs
# run: |
# mkdir -p dist
# $files = "${{ join(fromJSON(steps.tauri_build.outputs.artifacts),'","') }}"
# Copy-Item -Path $files -Destination dist
# - name: R2 Release
# uses: shallwefootball/[email protected]
# with:
# aws_key_id: ${{ secrets.R2_KEY }}
# aws_secret_access_key: ${{ secrets.R2_SECRET }}
# aws_bucket: monibuca
# source_dir: dist
# destination_dir: pro
# endpoint: https://${{ secrets.R2_DOMAIN }}
# build-tauri-mac:
# needs: build
# strategy:
# fail-fast: false
# matrix:
# rust_target:
# - x86_64
# - aarch64
# runs-on: macos-latest
# steps:
# - name: setup node
# uses: actions/setup-node@v3
# with:
# node-version: 18
# - name: install Rust stable
# uses: actions-rs/toolchain@v1
# with:
# default: true
# override: true
# profile: minimal
# toolchain: stable
# target: ${{ matrix.rust_target }}-apple-darwin
# - name: Download Artifact
# uses: actions/download-artifact@v4
# with:
# name: binaries
# - name: chmod
# run: |
# chmod 777 apps/gb28181/src-tauri/m7s-${{ matrix.rust_target }}-apple-darwin
# - uses: JonasKruckenberg/tauri-build@v1
# id: tauri_build
# env:
# TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
# with:
# target: ${{ matrix.rust_target }}-apple-darwin
# projectPath: apps/gb28181/src-tauri
# debug: true
# - name: copy ouputs
# run: |
# mkdir -p dist
# cp ${{ join(fromJSON(steps.tauri_build.outputs.artifacts),' ') }} dist/
# mv dist/m7s-pro.app dist/m7s-pro_${{ matrix.rust_target }}.app
# mv dist/m7s-pro.app.tar.gz dist/m7s-pro_${{ matrix.rust_target }}.app.tar.gz
# - name: R2 Release
# uses: shallwefootball/[email protected]
# with:
# aws_key_id: ${{ secrets.R2_KEY }}
# aws_secret_access_key: ${{ secrets.R2_SECRET }}
# aws_bucket: monibuca
# source_dir: dist
# destination_dir: pro
# endpoint: https://${{ secrets.R2_DOMAIN }}