Condensing and making it so it builds a single on master commits and full on tagged
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
name: Build Go Project
|
name: Build & Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["master"]
|
branches: ["master"]
|
||||||
|
tags:
|
||||||
|
- 'v*.*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
if: github.ref_type == 'branch'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -23,7 +24,42 @@ jobs:
|
|||||||
go build -o Sneedchat-Discord-Bridge .
|
go build -o Sneedchat-Discord-Bridge .
|
||||||
|
|
||||||
- name: Upload Build Artifact
|
- name: Upload Build Artifact
|
||||||
uses: https://gitea.com/actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: sneedchat-bridge-bin
|
name: Sneedchat-Discord-Bridge
|
||||||
path: 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/*
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
name: Build & Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*.*.*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
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
|
|
||||||
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: gitea.com/actions/release-action@v1
|
|
||||||
with:
|
|
||||||
api_key: ${{ secrets.CI_TOKEN }}
|
|
||||||
owner: Salastil
|
|
||||||
repo: Sneedchat-Discord-Bridge-Go
|
|
||||||
tag: ${{ github.ref_name }}
|
|
||||||
name: Release ${{ github.ref_name }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
files: dist/*
|
|
||||||
Reference in New Issue
Block a user