1 Commits

Author SHA1 Message Date
8e30741e37 ci: Initial build script 2025-03-03 06:32:17 +01:00
20 changed files with 5 additions and 13 deletions

View File

@@ -2,8 +2,8 @@ name: Build and Release Go App
on: on:
push: push:
# tags: tags:
# - 'v*' # Runs only when a new version tag is pushed - 'v*' # Runs only when a new version tag is pushed
jobs: jobs:
build: build:
@@ -23,27 +23,20 @@ jobs:
go-version: '1.21' go-version: '1.21'
- name: Set environment variables - name: Set environment variables
if: runner.os != 'Windows'
run: | run: |
echo "GOOS=${{ runner.os == 'Windows' && 'windows' || runner.os == 'macos' && 'darwin' || 'linux' }}" >> $GITHUB_ENV echo "GOOS=${{ runner.os == 'Windows' && 'windows' || runner.os == 'macos' && 'darwin' || 'linux' }}" >> $GITHUB_ENV
echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV echo "GOARCH=${{ matrix.goarch }}" >> $GITHUB_ENV
- name: Set environment variables
if: runner.os == 'Windows'
run: |
Add-Content -Path $env:GITHUB_ENV "GOOS=${{ runner.os == 'Windows' && 'windows' || runner.os == 'macos' && 'darwin' || 'linux' }}"
Add-Content -Path $env:GITHUB_ENV "GOARCH=${{ matrix.goarch }}"
- name: Build application - name: Build application
run: | run: |
mkdir -p dist mkdir -p dist
go build -o dist/alma-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOOS == 'windows' && '.exe' || '' }} go build -C ./src -o dist/alma-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOOS == 'windows' && '.exe' || '' }}
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: app-${{ env.GOOS }}-${{ env.GOARCH }} name: app-${{ env.GOOS }}-${{ env.GOARCH }}
path: dist/* path: src/dist/*
release: release:
name: Create GitHub Release name: Create GitHub Release
@@ -59,7 +52,7 @@ jobs:
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
files: dist/**/* files: dist/**/*
draft: true draft: false
prerelease: false prerelease: false
generate_release_notes: true generate_release_notes: true
env: env:

1
.gitignore vendored
View File

@@ -1,2 +1 @@
src/alma src/alma
alma

View File

View File

View File