Skip to content

docs rendered

docs rendered #22

Workflow file for this run

# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
name: Go
on:
push:
branches:
- "main"
label:
types: [created]
jobs:
go-test:
name: Go Test
uses: ./.github/workflows/test.yaml
go-build:
name: Go Build
if: github.event_name == 'push' || github.event_name == 'label' && contains(github.event.label.name, 'release')
needs:
- go-test
# TODO: other os's
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.22.1
- name: test new version
id: version
run: |-
ersion="$(go run ./cmd/yutc --version)"
version="v${ersion}"
if [[ -n "$(git tag -l "$version")" ]]; then
echo "::error::Version $version already exists"
exit 1
fi
echo "YUTC_VERSION=$version" >> $GITHUB_ENV
- name: build
id: build
run: |-
binary_name="yutc-linux-amd64"
go build -o "./dist/${binary_name}" ./cmd/yutc
echo "BINARY_NAME=$binary_name" >> "$GITHUB_ENV"
- name: release
id: release
env:
GITHUB_TOKEN: ${{ secrets.AUTH_TOKEN }}
run: |-
gh release create --generate-notes "${YUTC_VERSION}" "./dist/${BINARY_NAME}"