Skip to content

Commit

Permalink
feature(ci): push github ref as docker tag
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonStuff committed Apr 6, 2024
1 parent 06e9a20 commit 258405d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
build_and_push:
needs: test
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest

steps:
Expand All @@ -45,9 +45,17 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker image tag
id: prep
run: |
TAG=${GITHUB_REF#refs/*/}
echo ::set-output name=tag::${TAG}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/ns-object-mirror:latest
tags: |
ghcr.io/${{ github.repository_owner }}/ns-object-mirror:latest
ghcr.io/${{ github.repository_owner }}/ns-object-mirror:${{ github.ref }}

0 comments on commit 258405d

Please sign in to comment.