mirror of
https://github.com/wukko/cobalt.git
synced 2025-06-12 21:27:39 +02:00
build: add major version tag for docker images
This commit is contained in:
18
.github/workflows/docker.yml
vendored
18
.github/workflows/docker.yml
vendored
@ -29,20 +29,22 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Get version from package.json
|
||||
id: package-version
|
||||
uses: martinbeentjes/npm-get-version-action@v1.3.1
|
||||
- name: Get short commit hash
|
||||
id: commit-hash
|
||||
run: echo "commit_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
- name: Get release metadata
|
||||
id: release-meta
|
||||
run: |
|
||||
version=$(cat package.json | jq -r .version)
|
||||
echo "commit_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||
echo "version=$version" >> $GITHUB_OUTPUT
|
||||
echo "major_version=$(echo "$version" | cut -d. -f1)" >> $GITHUB_OUTPUT
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
tags: |
|
||||
type=raw,value=latest
|
||||
type=raw,value=${{ steps.package-version.outputs.current-version }}
|
||||
type=raw,value=${{ steps.package-version.outputs.current-version }}-${{ steps.commit-hash.outputs.commit_short }}
|
||||
type=raw,value=${{ steps.release-meta.outputs.version }}
|
||||
type=raw,value=${{ steps.release-meta.outputs.major_version }}
|
||||
type=raw,value=${{ steps.release-meta.outputs.version }}-${{ steps.release-meta.outputs.commit_short }}
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
|
Reference in New Issue
Block a user