Skip to content

Add GitHub Actions workflow for building and releasing #2

Add GitHub Actions workflow for building and releasing

Add GitHub Actions workflow for building and releasing #2

Workflow file for this run

name: CI/CD
on:
push:
branches:
- master
tags:
- 'v*'
pull_request:
branches:
- master
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.25'
- name: Install dependencies
run: go mod tidy
- name: Run tests
run: go test ./...
release:
name: Package and Release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.25'
- name: Install dependencies
run: go mod tidy
- name: Run package.sh
run: |
chmod +x ./package.sh
./package.sh ${{ github.ref_name }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}