65 lines
1.8 KiB
YAML
65 lines
1.8 KiB
YAML
name: Build & Release
|
|
on:
|
|
push:
|
|
branches: ["master"]
|
|
tags:
|
|
- 'v*.*'
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
if: github.ref_type == 'branch'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: "1.22"
|
|
|
|
- name: Build
|
|
run: |
|
|
go mod tidy
|
|
go build -o Sneedchat-Discord-Bridge .
|
|
|
|
- name: Upload Build Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Sneedchat-Discord-Bridge
|
|
path: Sneedchat-Discord-Bridge
|
|
|
|
- name: Update Master Tag
|
|
run: |
|
|
git config user.name "Gitea Actions"
|
|
git config user.email "actions@gitea.local"
|
|
git tag -f master
|
|
git push -f origin master
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v4
|
|
with:
|
|
go-version: "1.22"
|
|
|
|
- name: Build binaries
|
|
run: |
|
|
mkdir -p dist
|
|
go mod tidy
|
|
GOOS=linux GOARCH=amd64 go build -o dist/Sneedchat-Discord-Bridge-linux-amd64 .
|
|
GOOS=linux GOARCH=arm64 go build -o dist/Sneedchat-Discord-Bridge-linux-arm64 .
|
|
GOOS=windows GOARCH=amd64 go build -o dist/Sneedchat-Discord-Bridge-windows-amd64.exe .
|
|
GOOS=darwin GOARCH=amd64 go build -o dist/Sneedchat-Discord-Bridge-darwin-amd64 .
|
|
GOOS=darwin GOARCH=arm64 go build -o dist/Sneedchat-Discord-Bridge-darwin-arm64 .
|
|
|
|
- name: Create Gitea Release
|
|
uses: actions/release-action@v1
|
|
with:
|
|
token: ${{ secrets.CI_TOKEN }}
|
|
files: dist/* |