Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a calver action for tagging
Browse files Browse the repository at this point in the history
Serubin committed Mar 22, 2024

Verified

This commit was signed with the committer’s verified signature.
Serubin Solomon
1 parent 936a9ab commit dc8cf16
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ name: Build and Publish Docker Image
on:
push:
branches: ["master"]
tags: ["*"]

env:
REGISTRY: ghcr.io
@@ -28,14 +27,31 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get next version
uses: reecetech/[email protected]
id: version
with:
scheme: calver
increment: patch

- name: Create tag
uses: actions/github-script@v5
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.version.outputs.version }}',
sha: context.sha
})
- name: Extract metadata to create tags and labels
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{version}},value={{date 'YY.M.D' tz='America/New_York'}},enabled={{is_default_branch}}
type=raw,value=${{steps.version.outputs.version}},priority=300
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image

0 comments on commit dc8cf16

Please sign in to comment.