build: add major version tag for docker images
This commit is contained in:
parent
83d82f5da9
commit
08edf28ccf
2 changed files with 13 additions and 11 deletions
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
|
||||
|
|
|
@ -2,7 +2,7 @@ version: '3.5'
|
|||
|
||||
services:
|
||||
cobalt-api:
|
||||
image: ghcr.io/wukko/cobalt:latest
|
||||
image: ghcr.io/wukko/cobalt:7
|
||||
restart: unless-stopped
|
||||
container_name: cobalt-api
|
||||
|
||||
|
@ -32,7 +32,7 @@ services:
|
|||
#- ./cookies.json:/cookies.json
|
||||
|
||||
cobalt-web:
|
||||
image: ghcr.io/wukko/cobalt:latest
|
||||
image: ghcr.io/wukko/cobalt:7
|
||||
restart: unless-stopped
|
||||
container_name: cobalt-web
|
||||
|
||||
|
|
Loading…
Reference in a new issue