ci: set up build basics for linux amd64 (#5)
* ci: set up build basics for linux amd64 * ci: add darwin amd64 * feat: version awareness * ci: set version number * ci: create release * ci: attach to tag * ci: attach to tag * ci: attach to tag * ci: job permissions * ci: artifacts path * ci: artifacts path * ci: artifacts path * ci: artifacts path * ci: artifacts path * ci: artifacts path * ci: artifacts path * ci: artifacts path
This commit is contained in:
parent
32c7cb85df
commit
03a0440cbf
2 changed files with 63 additions and 0 deletions
60
.github/workflows/release.yml
vendored
Normal file
60
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-releases:
|
||||||
|
name: Build release artifacts
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [linux, darwin]
|
||||||
|
arch: [amd64]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version: '1.19.0'
|
||||||
|
- name: get tag
|
||||||
|
id: get_tag
|
||||||
|
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/v}
|
||||||
|
- name: Build for arch
|
||||||
|
env:
|
||||||
|
GOOS: ${{ matrix.os }}
|
||||||
|
GOARCH: ${{ matrix.arch }}
|
||||||
|
VERSION: ${{ steps.get_tag.outputs.tag }}
|
||||||
|
run: go build -ldflags "-X main.Version=$(echo $VERSION)"
|
||||||
|
- name: Stash
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: doggo-${{ matrix.os }}-${{ matrix.arch }}
|
||||||
|
path: ./doggo
|
||||||
|
publish:
|
||||||
|
name: Publish release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build-releases
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Retrieve artifacts
|
||||||
|
uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
path: release-builds
|
||||||
|
- name: Log artifact paths
|
||||||
|
run: |
|
||||||
|
pwd
|
||||||
|
ls -R
|
||||||
|
tar -czvf ./release-builds/doggo-darwin-amd64.tar.gz ./release-builds/doggo-darwin-amd64/doggo
|
||||||
|
tar -czvf ./release-builds/doggo-linux-amd64.tar.gz ./release-builds/doggo-linux-amd64/doggo
|
||||||
|
- name: Publish release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
./release-builds/*.tar.gz
|
3
main.go
3
main.go
|
@ -10,6 +10,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Version string
|
||||||
|
|
||||||
type Span struct {
|
type Span struct {
|
||||||
OrgId int `json:"org_id"`
|
OrgId int `json:"org_id"`
|
||||||
TraceId string `json:"trace_id"`
|
TraceId string `json:"trace_id"`
|
||||||
|
@ -177,6 +179,7 @@ func parseArgs(args []string) Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
log.Println("Doggo version: ", Version)
|
||||||
config := parseArgs(os.Args)
|
config := parseArgs(os.Args)
|
||||||
|
|
||||||
fullTrace := parseTraceJsonFromFile(config.tracePath)
|
fullTrace := parseTraceJsonFromFile(config.tracePath)
|
||||||
|
|
Reference in a new issue