Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

chore: Run formatter #74

chore: Run formatter

chore: Run formatter #74

Workflow file for this run

name: Publish to Docker Hub
env:
DOCKER_IMAGE: ghcr.io/elseu/sdu-oidc-jwt-provider
on:
push:
tags:
- "v*"
branches:
- master
- develop
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
run: docker build -t $DOCKER_IMAGE .
- name: Push to latest
if: github.ref == 'refs/heads/master'
run: docker tag $DOCKER_IMAGE $DOCKER_IMAGE:latest && docker push $DOCKER_IMAGE:latest
- name: Push to develop
if: github.ref == 'refs/heads/develop'
run: docker tag $DOCKER_IMAGE $DOCKER_IMAGE:next && docker push $DOCKER_IMAGE:next
- name: Push to versions
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION_SUFFIX=$(echo ${GITHUB_REF/refs\/tags\/v/} | sed -E s/[^-]+//)
MAJOR_VERSION=$(echo ${GITHUB_REF/refs\/tags\/v/} | sed -E s/^\([0-9]+\).*$/\\1/ | sed -E s/-.*$//)
MINOR_VERSION=$(echo ${GITHUB_REF/refs\/tags\/v/} | sed -E s/^\([0-9]+\.[0-9]+\).*$/\\1/ | sed -E s/-.*$//)
FULL_VERSION=$(echo ${GITHUB_REF/refs\/tags\/v/} | sed -E s/^\([0-9]+\.[0-9]+\.[0-9]+\).*$/\\1/ | sed -E s/-.*$//)
if [ ! -z "$MAJOR_VERSION" ]; then
docker tag $DOCKER_IMAGE $DOCKER_IMAGE:$MAJOR_VERSION$VERSION_SUFFIX && docker push $DOCKER_IMAGE:$MAJOR_VERSION$VERSION_SUFFIX
fi
if [ ! -z "$MINOR_VERSION" ]; then
docker tag $DOCKER_IMAGE $DOCKER_IMAGE:$MINOR_VERSION$VERSION_SUFFIX && docker push $DOCKER_IMAGE:$MINOR_VERSION$VERSION_SUFFIX
fi
if [ ! -z "$FULL_VERSION" ]; then
docker tag $DOCKER_IMAGE $DOCKER_IMAGE:$FULL_VERSION$VERSION_SUFFIX && docker push $DOCKER_IMAGE:$FULL_VERSION$VERSION_SUFFIX
fi