From a6d1ca1f658aefb38d14e8e3474488de349f0802 Mon Sep 17 00:00:00 2001 From: RouxAntoine Date: Wed, 12 Jul 2023 00:45:04 +0200 Subject: [PATCH] feature: add binary push on release action --- .gitea/workflows/release.yaml | 34 ++++++++++++++++++++++++++++++++++ Makefile | 4 +++- 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/release.yaml diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml new file mode 100644 index 0000000..95aabb6 --- /dev/null +++ b/.gitea/workflows/release.yaml @@ -0,0 +1,34 @@ +name: Main + +on: + push: + branches: + - master + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: RouxAntoine/checkout@v3.5.4 + - uses: actions/setup-go@v4 + with: + go-version: '1.20.4' + + - run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - run: make build VERSION=$RELEASE_VERSION GOOS=linux GOARCH=amd64 GO_BUILD_FLAGS="-tags prod" + + - name: Request Postman Echo POST and persist response + id: pushArtifact + uses: fjogeleit/http-request-action@v1 + with: + url: "https://antoine-roux.tk/projects/api/packages/go/docker-multi-arch-builder/generic/docker-multi-arch-builder/$RELEASE_VERSION/docker-multi-arch-builder" + method: 'PUT' + file: "${{ github.workspace }}/bin/docker-multi-arch-builder-darwin-amd64" + + - name: Show Response + run: | + echo ${{ steps.pushArtifact.outputs.response }} + echo ${{ steps.pushArtifact.outputs.headers }} diff --git a/Makefile b/Makefile index b477573..4e81645 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,9 @@ GOARCH=amd64 # GOARCH=arm GOOS=darwin # GOOS=linux -LDFLAGS=-w -s -X go/weather/internal/version.Version=$$(git rev-list -1 HEAD) + +VERSION=$$(git rev-list -1 HEAD) +LDFLAGS=-w -s -X go/weather/internal/version.Version=$(VERSION) GO_BUILD_FLAGS=-tags dev CGO_ENABLED=0