Skip to content

fix semantic versioning #2

fix semantic versioning

fix semantic versioning #2

Workflow file for this run

name: Go CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:

Check failure on line 11 in .github/workflows/go.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/go.yml

Invalid workflow file

You have an error in your yaml syntax on line 11
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.22'
- name: Run static checks
run: go vet ./...
- name: Run audit
run: go mod tidy && go mod vendor
- name: Format code
run: go fmt ./...
- name: Test
run: go test -v ./...
- name: Build
run: go build -o tgcom ./cmd/tgcom
- name: Semantic Versioning
id: semver
run: |
VERSION=$(git describe --tags --abbrev=0)
if [ -z "$VERSION" ]; then
VERSION="v0.1.0"
else
VERSION=$(echo "$VERSION" | awk -F. '{$NF = $NF + 1;} 1' | sed 's/ /./g')
fi
echo "New version: $VERSION"
echo "::set-output name=version::$VERSION"
release:
needs: build
name: Release
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Create release
uses: actions/create-release@v1
with:
tag_name: ${{ steps.semver.outputs.version }}
release_name: ${{ steps.semver.outputs.version }}
body: |
Release ${{ steps.semver.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}