Skip to content

Fix container building action #45

Fix container building action

Fix container building action #45

name: Build and publish container images
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
branches:
- 'develop'
jobs:
eventsignup_backend-image:
name: Build & push container image
runs-on: ubuntu-latest
env:
IMG_NAME: ghcr.io/${{ github.repository }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Debug
run: |
echo "github.ref -> {{ github.ref }}"
- name: Container metadata
id: metadata
uses: docker/metadata-action@v3
with:
images: ${{ env.IMG_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value={{sha}},enable=${{ github.ref_type != 'tag' }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.gh_user }}
password: ${{ secrets.gh_token }}
- name: Build and push container image
uses: docker/[email protected]
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
typescript-types:
runs-on: ubuntu-latest
container: eclipse-temurin:21
env:
DB_HOST: postgres
DB_PORT: 5432
KEYCLOAK_URL: localhost
SPRING_PROFILES_ACTIVE: dev
GIT_TAG: ${GITHUB_REF_NAME}
services:
postgres:
image: postgres:17.0
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Authenticate to github packages
run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.gh_token }}' > ~/.npmrc
- name: Update typescript types
run: ./gradlew generateTsTypes
- name: Generate new version number
run: ./gradlew generateTypesVersionNumber
env:
GIT_TAG: ${{ github.ref_name }}
- name: Push new version to npm registry
run: ./gradlew publishTypesPlugin
keycloak-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Authenticate to container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ secrets.gh_user }}
password: ${{ secrets.gh_token }}
- name: Build keycloak image
run: docker build --file keycloak/Dockerfile.ci --tag ghcr.io/asteriskiry/keycloak:latest keycloak
- name: Push keycloak image to container registry
run: docker push ghcr.io/asteriskiry/keycloak:latest