From 003dcb8333974ddaa830d285f8e48d3d13275de1 Mon Sep 17 00:00:00 2001 From: Gabriel Saratura Date: Tue, 4 Apr 2023 14:15:54 +0200 Subject: [PATCH] Update release process --- .github/workflows/release.yml | 6 ++++-- .goreleaser.yml | 4 +++- Dockerfile | 2 +- Makefile | 4 ++++ Makefile.vars.mk | 2 +- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0d42b6c..fdcb7c6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,6 +40,9 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Push docker image + run: make docker-push -e IMG_TAG=${GITHUB_REF##*/} + - name: Build changelog from PRs with labels id: build_changelog uses: mikepenz/release-changelog-builder-action@v3 @@ -57,8 +60,7 @@ jobs: uses: goreleaser/goreleaser-action@v4 with: args: release --release-notes .github/release-notes.md - workdir: ./cmd/vshn-postgres-func env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + IMAGE_NAME: ${{ github.repository }}/vshn-postgres-func diff --git a/.goreleaser.yml b/.goreleaser.yml index 797a265..5120495 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,7 +1,9 @@ # This is an example goreleaser.yaml file with some sane defaults. # Make sure to check the documentation at http://goreleaser.com builds: -- env: +- id: vshn-postgres + main: ./cmd/vshn-postgres-func + env: - CGO_ENABLED=0 # this is needed otherwise the Docker image build is faulty goarch: - amd64 diff --git a/Dockerfile b/Dockerfile index 739a6d8..430e45a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG INSTANCE="" WORKDIR /app COPY . ./ -RUN go mod download +RUN echo $(ls -a) && go mod download RUN cd "cmd/$INSTANCE" && CGO_ENABLED=0 go build -o functionio . diff --git a/Makefile b/Makefile index 41f35be..19cd86b 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,10 @@ clean: recursive_target=.clean-build-img clean: $(instances) rm -rf docs/node_modules $(docs_out_dir) dist .cache $(WORK_DIR) +.PHONY: docker-push +docker-push: build-docker ## Push docker image with the manager. + docker push $(CONTAINER_IMG) + .PHONY: .clean-build-img .clean-build-img: docker rmi $(CONTAINER_IMG) -f || true diff --git a/Makefile.vars.mk b/Makefile.vars.mk index 8218856..a640c36 100644 --- a/Makefile.vars.mk +++ b/Makefile.vars.mk @@ -22,7 +22,7 @@ DOCKER_CMD ?= docker ## BUILD:docker VSHN Postgres IMG_TAG ?= latest # Image URL to use all building/pushing image targets -CONTAINER_IMG ?= ghcr.io/$(PROJECT_OWNER)/$(BIN_FILENAME):$(IMG_TAG) +CONTAINER_IMG ?= ghcr.io/$(PROJECT_OWNER)/$(PROJECT_NAME)/$(BIN_FILENAME):$(IMG_TAG) ## KIND:setup