docs rendered #22
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
# 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}" |