From 0570773f5081ad5e5356d7ed199cf7e1db035a17 Mon Sep 17 00:00:00 2001 From: Edinaldo Pereira da Silva Junior <69252337+epsjunior@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:28:18 -0300 Subject: [PATCH] feat: pushing version when workflow is called using schedule (#687) --- .../workflows/docker-build-and-push-image.yml | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/docker-build-and-push-image.yml b/.github/workflows/docker-build-and-push-image.yml index 9418b3f7..c6d17741 100644 --- a/.github/workflows/docker-build-and-push-image.yml +++ b/.github/workflows/docker-build-and-push-image.yml @@ -31,25 +31,11 @@ jobs: steps: - uses: actions/checkout@v4 - # TODO: Once we have the 1Password service account token, we can use the following action to load secrets - # "better done than perfect" - - # - name: Load secrets from 1Password - # uses: 1password/load-secrets-action/configure@v1 - # id: op-load-secret - # with: - # service-account-token: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} - # env: - # DOCKERHUB_USERNAME: - # DOCKERHUB_TOKEN: - - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ inputs.dockerhub_username }} password: ${{ secrets.dockerhub_token }} - # username: ${{ steps.op-load-secret.outputs.DOCKERHUB_USERNAME }} - # password: ${{ steps.op-load-secret.outputs.DOCKERHUB_TOKEN }} - name: Create .env file run: cp .env.example .env @@ -57,7 +43,15 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - # jsonrpc + - name: Fetch All Tags + run: git fetch --tags + + - name: Get the Most Recent Git Tag + id: get_latest_tag + run: | + latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "latest_tag=$latest_tag" >> $GITHUB_ENV + - name: Docker Metadata id: meta uses: docker/metadata-action@v5 @@ -65,9 +59,8 @@ jobs: images: | ${{ inputs.dockerhub_repo }} tags: | - type=ref,event=tag - type=raw,value=latest - type=semver,pattern={{version}} + ${{ env.latest_tag }} + latest - name: Build and push uses: docker/build-push-action@v6