From c1348f9052b9d1331d950d86c66ab27fa134bc2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Kleinb=C3=B6lting?= Date: Wed, 4 Sep 2024 14:41:17 +0200 Subject: [PATCH] build: Use cargo version for publishing images from release tags --- .github/workflows/publish.yml | 6 +++--- justfile | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 62ab2585..451d550c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -61,7 +61,7 @@ jobs: name: manifest runs-on: ubuntu-latest needs: [publish_amd64, publish_arm64] - if: github.ref == 'refs/heads/main' || (github.event_name == 'create' && startsWith(github.ref, 'refs/tags/dsp-meta-cmd')) + if: github.ref == 'refs/heads/main' || (github.event_name == 'create' && startsWith(github.ref, 'refs/tags')) outputs: tag: ${{ steps.output_docker_image_tag.outputs.tag }} steps: @@ -83,7 +83,7 @@ jobs: name: Trigger deployment to DEV runs-on: ubuntu-latest needs: publish_manifest - if: github.ref == 'refs/heads/main' || (github.event_name == 'create' && startsWith(github.ref, 'refs/tags/dsp-meta-cmd')) + if: github.ref == 'refs/heads/main' steps: - name: Trigger deployment to DEV env: @@ -98,7 +98,7 @@ jobs: release-please: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' || (github.event_name == 'create' && startsWith(github.ref, 'refs/tags/dsp-meta-cmd')) + if: github.ref == 'refs/heads/main' steps: - uses: googleapis/release-please-action@v4 with: diff --git a/justfile b/justfile index 6cfb9e8e..a5f1040b 100644 --- a/justfile +++ b/justfile @@ -1,7 +1,8 @@ DOCKER_REPO := "daschswiss/dsp-meta-server" CARGO_VERSION := `cargo metadata --format-version=1 --no-deps | jq --raw-output '.packages[].version'` COMMIT_HASH := `git log --pretty=format:'%h' -n 1` -IMAGE_TAG := CARGO_VERSION + "-" + COMMIT_HASH +GIT_TAG := `git describe --tags --exact-match 2>/dev/null || true` +IMAGE_TAG := if GIT_TAG == "" { CARGO_VERSION + "-" + COMMIT_HASH } else { GIT_TAG } DOCKER_IMAGE := DOCKER_REPO + ":" + IMAGE_TAG # List all recipies