Skip to content

Commit

Permalink
added prefix and suffix to front version
Browse files Browse the repository at this point in the history
  • Loading branch information
zurdi15 committed Dec 23, 2023
1 parent 2c2e67f commit 4243873
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,18 @@ 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: |
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 "VERSION_PREFIX=${{ github.ref != format('refs/heads/{0}', 'release') && 'dev-' || '' }}" >> $GITHUB_ENV
echo "VERSION_SUFFIX=${{ github.ref == format('refs/heads/{0}', 'master') && '-rc.$NEXT_RC_VERSION' || '' }}" >> $GITHUB_ENV
- name: Set version
run: sed -i 's/<version>/'"${{ inputs.version }}"'/' backend/__version__.py
run: |
version=${{ env.VERSION_PREFIX }}${{ inputs.version }}${{ env.VERSION_SUFFIX }}
sed -i 's/<version>/'"${version}"'/' backend/__version__.py
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -44,14 +51,6 @@ 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
Expand All @@ -62,8 +61,8 @@ jobs:
flavor: |
# 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
prefix=${{ env.VERSION_PREFIX }},onlatest=true
suffix=${{ env.VERSION_SUFFIX }},onlatest=false
tags: |
type=raw,value=${{ inputs.version }}
labels: |
Expand Down

0 comments on commit 4243873

Please sign in to comment.