Compare commits
1 Commits
main
...
v0.0.6-alp
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e30741e37 |
60
.github/workflows/github-actions.yml
vendored
Normal file
60
.github/workflows/github-actions.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
name: Build and Release Go App
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # Runs only when a new version tag is pushed
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Go App
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
goarch: [amd64]
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Set environment variables
|
||||
run: |
|
||||
echo "GOOS=${{ runner.os == 'Windows' && 'windows' || runner.os == 'macos' && 'darwin' || 'linux' }}" >> $GITHUB_ENV
|
||||
echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Build application
|
||||
run: |
|
||||
mkdir -p dist
|
||||
go build -C ./src -o dist/alma-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOOS == 'windows' && '.exe' || '' }}
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: app-${{ env.GOOS }}-${{ env.GOARCH }}
|
||||
path: src/dist/*
|
||||
|
||||
release:
|
||||
name: Create GitHub Release
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: dist
|
||||
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: dist/**/*
|
||||
draft: false
|
||||
prerelease: false
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user