Skip to content

Commit

Permalink
fix: Updated github actions workflow for dockerhub tag generation
Browse files Browse the repository at this point in the history
  • Loading branch information
KvelaGorrrrnio committed Nov 9, 2021
1 parent b933276 commit 47e6ea9
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 13 deletions.
30 changes: 30 additions & 0 deletions .github/actions/extract-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'Extract version'
description: 'Split semver version into major, minor and patch (and version).'
inputs:
version:
description: 'Version as string'
required: true
outputs:
version:
description: "Full version"
value: ${{ steps.match.outputs.group1 }}
major:
description: "Major version"
value: ${{ steps.match.outputs.group2 }}
minor:
description: "Minor version"
value: ${{ steps.match.outputs.group3 }}
patch:
description: "Patch version"
value: ${{ steps.match.outputs.group4 }}
runs:
using: 'composite'
steps:
- run: echo "${{ inputs.version }}"
shell: bash
- name: Match Semantic Version
uses: actions-ecosystem/action-regex-match@v2
id: match
with:
text: ${{ inputs.version }}
regex: '^v?(?<version>(?<major>[0-9]+).(?<minor>[0-9]+).(?<patch>[0-9]+))$'
2 changes: 1 addition & 1 deletion .github/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.11.0-locally-modified
1.11.4-locally-modified
2 changes: 1 addition & 1 deletion .github/workflows/node-ci.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
with:
images: "tv2media/${{ github.event.repository.name }}"
tags: |
develop
type=ref,event=branch
- name: Log in to Docker Hub
uses: docker/login-action@v1
Expand Down
27 changes: 16 additions & 11 deletions .github/workflows/node-ci.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,16 +281,18 @@ jobs:
name: ${{ github.event.repository.name }}
path: dist

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
- name: Get raw version
id: raw-version
uses: notiz-dev/github-action-json-property@release
with:
path: 'package.json'
prop_path: 'version'

- name: Extract version for tags
id: version
uses: ./.github/actions/extract-version
with:
images: "tv2media/${{ github.event.repository.name }}"
tags: |
latest
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
version: ${{ steps.raw-version.outputs.prop }}

- name: Log in to Docker Hub
uses: docker/login-action@v1
Expand All @@ -303,6 +305,9 @@ jobs:
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
tags: |
"tv2media/${{ github.event.repository.name }}:latest"
"tv2media/${{ github.event.repository.name }}:${{ steps.version.outputs.version }}"
"tv2media/${{ github.event.repository.name }}:${{ steps.version.outputs.major }}"
"tv2media/${{ github.event.repository.name }}:${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}"

0 comments on commit 47e6ea9

Please sign in to comment.