Merge pull request #508 from zurdi15/feature/improve_build_workflow

Feature/improve build workflow
This commit is contained in:
Zurdi
2023-12-22 22:53:07 +01:00
committed by Zurdi
2 changed files with 19 additions and 10 deletions

View File

@@ -19,8 +19,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Set environment variables
run: echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
# - name: Set environment variables
# run: echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set version
run: sed -i 's/<version>/'"${{ inputs.version }}"'/' backend/__version__.py
@@ -44,6 +44,14 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get last image rc version
if: github.ref == format('refs/heads/{0}', 'master')
run: |
CURRENT_RC_VERSION=$(wget -q -O - "https://hub.docker.com/v2/repositories/zurdi15/romm/tags?page_size=2" | grep -o '"name": *"[^"]*' | grep -o '[^"]*$' | grep "dev-${{ inputs.version }}-rc" | cut -d "-" -f 3 | cut -d "." -f 2)
[[ -z $CURRENT_RC_VERSION ]] && CURRENT_RC_VERSION=0
NEXT_RC_VERSION="$(($CURRENT_RC_VERSION + 1))"
echo "RC_SUFFIX=-rc.$NEXT_RC_VERSION" >> $GITHUB_ENV
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v4
@@ -55,6 +63,7 @@ jobs:
# latest on release branch, prefix dev on other branches
latest=true
prefix=${{ github.ref != format('refs/heads/{0}', 'release') && 'dev-' || '' }},onlatest=true
suffix=${{ github.ref == format('refs/heads/{0}', 'master') && env.RC_SUFFIX || '' }},onlatest=false
tags: |
type=raw,value=${{ inputs.version }}
labels: |