From 9244f27638131be8250c4e5dbcf832b8e763c000 Mon Sep 17 00:00:00 2001 From: Shane Jaroch Date: Mon, 15 Apr 2024 23:11:35 -0400 Subject: [PATCH] update makefile, workflow --- .github/workflows/test.yml | 7 +++---- Makefile | 22 +++++++++------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a84b3ef..08c221e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,13 +37,12 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - RELEASE_TAG=v$(python3 sql/latest_version.py) - echo RELEASE_TAG=$RELEASE_TAG - test -n "$RELEASE_TAG" + RELEASE_TAG=$(make deploy/get-current-db-version) # Test that github-cli is working gh --version gh release list -L 1 - # TODO: enhance this to be: if release_tag > current_prod_tag, deploy + # TODO: enhance this to be: if release_tag > current_prod_tag, deploy. + # Otherwise, can skip this step entirely? gh release view $RELEASE_TAG || echo "PUBLISH=1" >> "$GITHUB_OUTPUT" # yamllint disable rule:line-length diff --git a/Makefile b/Makefile index 62b58db..c07423c 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,13 @@ build: ## Build the release ./sql/build.sh ${DB_VERSION} du -h ${DB_FILE} + +.PHONY: deploy/get-current-db-version +deploy/get-current-db-version: + @test "${DB_VERSION}" + @echo v${DB_VERSION} + + .PHONY: deploy/upload deploy/upload: ## Upload to GitHub releases test -n "${DB_VERSION}" @@ -60,20 +67,13 @@ deploy/upload: ## Upload to GitHub releases .PHONY: deploy/delete deploy/delete: + [[ "$(shell read -e -p 'Really delete v${DB_VERSION}? [y/N]> '; echo $$REPLY)" == [Yy]* ]] gh release delete v${DB_VERSION} git push origin --delete v${DB_VERSION} - git tag -d v${DB_VERSION} REMOTE_HEAD ?= origin/master - -.PHONY: _check-git-up-to-date -_check-git-up-to-date: - git branch --show-current - git fetch - # Check that we are in sync with ${REMOTE_HEAD} - git diff --quiet ${REMOTE_HEAD} - PROJECT_NAME ?= usda-sqlite .PHONY: deploy/install-prod @@ -98,11 +98,7 @@ clean: ## Clean up leftover bits and stuff from build .PHONY: check-vars check-vars: ## display all computed vars (won't show passed in) - $(info --vars--) - $(foreach v, \ - $(filter-out $(FILTERED_VARS) FILTERED_VARS,$(.VARIABLES)), \ - $(info $(v) = $($(v)))) - @printf '' + $(foreach v, $(.VARIABLES), $(if $(filter file, $(origin $(v))), $(info $(v)=$($(v))))) .PHONY: extras/cloc extras/cloc: -- 2.52.0