Added input mode to fix parsing. #9
This file contains hidden or 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: Production CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| cache: true | |
| - name: Get dependencies | |
| run: go mod download | |
| - name: Run tests | |
| run: go test -v ./... | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| cache: true | |
| - name: Get dependencies | |
| run: go mod download | |
| - name: Build | |
| run: | | |
| mkdir -p build | |
| VERSION=$(grep -oP 'Version = "\K[^"]+' pkg/version/version.go) | |
| BUILD_DATE=$(date +%Y-%m-%d) | |
| GIT_COMMIT=$(git rev-parse --short HEAD) | |
| GO_VERSION=$(go version | awk '{print $3}') | |
| LDFLAGS="-X github.com/agnath18/lumo/pkg/version.Version=${VERSION} -X github.com/agnath18/lumo/pkg/version.BuildDate=${BUILD_DATE} -X github.com/agnath18/lumo/pkg/version.GitCommit=${GIT_COMMIT} -X github.com/agnath18/lumo/pkg/version.GoVersion=${GO_VERSION}" | |
| go build -ldflags "${LDFLAGS}" -o build/lumo cmd/lumo/main.go | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: lumo-linux-amd64 | |
| path: build/lumo | |
| retention-days: 7 | |
| validate-release: | |
| name: Validate Release Process | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22' | |
| cache: true | |
| - name: Set Go version environment variable | |
| run: echo "GOVERSION=$(go version | awk '{print $3}')" >> $GITHUB_ENV | |
| - name: Run GoReleaser (Dry Run) | |
| uses: goreleaser/goreleaser-action@v5 | |
| with: | |
| distribution: goreleaser | |
| version: latest | |
| args: release --snapshot --clean --skip=publish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |