From b25ec0908bc7733c49e1f4a749d9f5c7dd98187c Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 1 Dec 2023 00:31:11 +0500 Subject: [PATCH] build: publish workflow --- .github/workflows/publish.yml | 32 ++++++++++++++++++++++++++++++++ .goreleaser.yaml | 17 +++++++++++++++++ codapi.service | 2 +- 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b45391c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,32 @@ +name: publish + +on: + push: + tags: + - "*" + workflow_dispatch: + +permissions: + contents: write + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: "stable" + + - name: Install dependencies + run: go get . + + - name: Release and publish + uses: goreleaser/goreleaser-action@v4 + with: + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..523e74c --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,17 @@ +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + main: ./cmd/main.go + +archives: + - files: + - "*.json" + - images/* + - codapi.service + - LICENSE diff --git a/codapi.service b/codapi.service index 6bec4c5..95a80fd 100644 --- a/codapi.service +++ b/codapi.service @@ -6,7 +6,7 @@ After=network.target Type=simple User=codapi WorkingDirectory=/opt/codapi -ExecStart=/opt/codapi/build/codapi +ExecStart=/opt/codapi/codapi Restart=on-failure StandardOutput=file:/opt/codapi/codapi.log StandardError=file:/opt/codapi/codapi.log