Skip to content

Commit

Permalink
Add get-tag action
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdannbv committed Aug 1, 2022
1 parent 3b776c7 commit d7a10c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .github/actions/get-tag/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: 'Get Tag'
description: 'Get the tag from $GITHUB_REF.'
outputs:
tag:
description: 'Tag'
value: ${{ steps.get-tag.outputs.tag }}
runs:
using: 'composite'
steps:
- id: get-tag
run: echo "::set-output name=tag::$(echo ${GITHUB_REF#refs/tags/})"
shell: bash
8 changes: 6 additions & 2 deletions .github/workflows/docker-build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3


- name: Get tag
id: get-tag
uses: ./.github/actions/get-tag

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

Expand All @@ -27,4 +31,4 @@ jobs:
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ github.repository }}:${GITHUB_REF##*/}, ${{ github.repository }}:${GITHUB_SHA}
tags: ${{ github.repository }}:${{ steps.get-tag.outputs.tag }}, ${{ github.repository }}:latest

0 comments on commit d7a10c2

Please sign in to comment.