add CI/CD workflows

This commit is contained in:
tumillanino
2025-10-28 23:05:22 +11:00
parent 27ca5a9426
commit bfc87a75ee
2 changed files with 88 additions and 0 deletions

33
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.25'
- name: Build
run: make build
- name: Test
run: make test
- name: Vet
run: make vet
- name: Format check
run: |
make fmt
git diff --exit-code

55
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.25'
- name: Build release binary
run: |
make release
cd build
sha256sum miasma-installer > miasma-installer.sha256
- name: Create Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/miasma-installer
asset_name: miasma-installer
asset_content_type: application/octet-stream
- name: Upload Checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/miasma-installer.sha256
asset_name: miasma-installer.sha256
asset_content_type: text/plain