From 94efe4ea80fe04dfb6d398ddb54154433fa1390b Mon Sep 17 00:00:00 2001 From: Jarno Rankinen Date: Wed, 27 Mar 2024 04:25:25 +0000 Subject: [PATCH] Build workflow, devcontainer file --- .devcontainer/devcontainer.json | 28 ++++++++++++++++++++++++++ .github/workflows/buildBinary.yaml | 28 ++++++++++++++++++++++++++ .goreleaser.yaml | 32 ++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .github/workflows/buildBinary.yaml create mode 100644 .goreleaser.yaml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..01ac77c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,28 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/go +{ + "name": "Go", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/go:1-1.22-bookworm", + + "remoteUser": "vscode", + "containerUser": "vscode", + "workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind,Z", + "workspaceFolder": "/workspace", + "runArgs": ["--userns=keep-id"] + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "go version", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/workflows/buildBinary.yaml b/.github/workflows/buildBinary.yaml new file mode 100644 index 0000000..59f3f34 --- /dev/null +++ b/.github/workflows/buildBinary.yaml @@ -0,0 +1,28 @@ +on: + push: + tags: + - "*" + workflow_dispatch: + + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.22.1' + - name: Build release binaries + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GO_RELEASER_TOKEN }} \ No newline at end of file diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..85c8502 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,32 @@ +version: 1 + +before: + hooks: + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + goarch: + - amd64 + - arm64 + - arm + +archives: + - format: binary + name_template: >- + {{ .ProjectName }}- + {{- .Os }}- + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + - "^ci:" \ No newline at end of file