Skip to content

Commit

Permalink
test next rc version
Browse files Browse the repository at this point in the history
  • Loading branch information
zurdi15 committed Dec 22, 2023
1 parent 8385578 commit 9745664
Showing 1 changed file with 66 additions and 48 deletions.
114 changes: 66 additions & 48 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
description: "romm version"
required: true
type: string
releaseCandidate:
description: "release candidate?"
type: boolean
required: true
default: false

jobs:
build:
Expand All @@ -16,58 +21,71 @@ jobs:
contents: write
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v3
# - name: Checkout code
# uses: actions/checkout@v3

# - 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

- name: Set environment variables
run: echo "GIT_BRANCH=${GITHUB_REF##*/}" >> $GITHUB_ENV
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2

- name: Set version
run: sed -i 's/<version>/'"${{ inputs.version }}"'/' backend/__version__.py
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# - name: Login to Docker Hub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get last image tag
if: ${{ inputs.releaseCandidate }}
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-${version}-rc" | cut -d "-" -f 3 | cut -d "." -f 2)
NEXT_RC_VERSION=$(($CURRENT_RC_VERSION + 1))
echo "NEXT_RC_VERSION=$(($CURRENT_RC_VERSION + 1))" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Test get last image tag variable
if: ${{ inputs.releaseCandidate }}
run: |
echo $NEXT_RC_VERSION
- name: Generate Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
name=zurdi15/romm
name=ghcr.io/zurdi15/romm
flavor: |
# latest on release branch, prefix dev on other branches
latest=true
prefix=${{ github.ref != format('refs/heads/{0}', 'release') && 'dev-' || '' }},onlatest=true
tags: |
type=raw,value=${{ inputs.version }}
labels: |
org.opencontainers.image.version=${{ inputs.version }}
org.opencontainers.image.title="zurdi15/romm"
org.opencontainers.image.description="RomM (stands for Rom Manager) is a game library manager focused in retro gaming. Manage and organize all of your games from a web browser"
org.opencontainers.image.licenses="GPL-3.0"
- name: Build image
uses: docker/build-push-action@v4
with:
file: docker/Dockerfile
context: .
push: true
platforms: linux/arm64,linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# - name: Generate Docker metadata
# id: meta
# uses: docker/metadata-action@v4
# with:
# images: |
# name=zurdi15/romm
# name=ghcr.io/zurdi15/romm
# 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}', 'release') && ${{ inputs.releaseCandidate }} && '-rc.' || '' }},onlatest=true
# tags: |
# type=raw,value=${{ inputs.version }}
# labels: |
# org.opencontainers.image.version=${{ inputs.version }}
# org.opencontainers.image.title="zurdi15/romm"
# org.opencontainers.image.description="RomM (stands for Rom Manager) is a game library manager focused in retro gaming. Manage and organize all of your games from a web browser"
# org.opencontainers.image.licenses="GPL-3.0"
# - name: Build image
# uses: docker/build-push-action@v4
# with:
# file: docker/Dockerfile
# context: .
# push: true
# platforms: linux/arm64,linux/amd64
# tags: ${{ steps.meta.outputs.tags }}
# labels: ${{ steps.meta.outputs.labels }}

0 comments on commit 9745664

Please sign in to comment.