Initial commit #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
release: | |
types: [created] | |
jobs: | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "1.23.2" | |
- name: Run Tests | |
run: go test ./... | |
build: | |
name: Build Release | |
runs-on: ubuntu-latest | |
needs: test | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: "1.23.2" | |
- name: Build for Linux | |
run: GOOS=linux GOARCH=amd64 go build -o release/local-ci-linux-amd64 ./ | |
- name: Build for macOS | |
run: GOOS=darwin GOARCH=amd64 go build -o release/local-ci-darwin-amd64 ./ | |
- name: Build for Windows | |
run: GOOS=windows GOARCH=amd64 go build -o release/local-ci-windows-amd64.exe ./ | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ github.ref }} | |
files: | | |
release/local-ci-linux-amd64 | |
release/local-ci-darwin-amd64 | |
release/local-ci-windows-amd64.exe | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |