]> Nutra Git (v2) - nutratech/usda-sqlite.git/commitdiff
update makefile, workflow
authorShane Jaroch <chown_tee@proton.me>
Tue, 16 Apr 2024 03:11:35 +0000 (23:11 -0400)
committerShane Jaroch <chown_tee@proton.me>
Tue, 16 Apr 2024 03:11:35 +0000 (23:11 -0400)
.github/workflows/test.yml
Makefile

index a84b3ef79a74eb40ce4908932cebc34cc3fdaf1b..08c221ef1eb783c31bddd37a0d5aee3b5fda036e 100644 (file)
@@ -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
index 62b58db3b30ce59ee01b57234ce0f1906f038ac9..c07423c86507932d7ee09b2d7c72c152585996e4 100644 (file)
--- 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: