Skip to content

Merge pull request #10 from fhswf/dependabot #97

Merge pull request #10 from fhswf/dependabot

Merge pull request #10 from fhswf/dependabot #97

Workflow file for this run

name: build
on:
push:
branches:
- main
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: echo ${{ steps.semantic_release.outputs.new_release_published }}
outputs:
new_release_published: ${{ steps.semantic_release.outputs.new_release_published }}
new_release_version: ${{ steps.semantic_release.outputs.new_release_version }}
latest_release_version: ${{ steps.semantic_release.outputs.latest_release_version }}
build:
name: Build
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: SonarQube
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
SONAR_ROOT_CERT: ${{ secrets.SONAR_ROOT_CERT }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/fhswf/openai-proxy
flavor: |
latest=true
labels: |
org.opencontainers.image.description=OpenAI Proxy
org.opencontainers.image.licenses=MIT
org.opencontainers.image.source=https://github.com/fhswf/openai-proxy
# generate Docker tags based on the following events/attributes
tags: |
type=sha,prefix=sha-,format=short,enable=true,priority=1100
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=raw,value=${{ env.RELEASE_VERSION }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
sbom: true
- name: Update yaml
uses: fjogeleit/yaml-update-action@main
with:
valueFile: 'k8s/deployment.yaml'
propertyPath: 'spec.template.spec.containers[0].image'
value: ghcr.io/fhswf/openai-proxy:${{ env.DOCKER_METADATA_OUTPUT_VERSION }}
branch: main
message: 'Update image to ${{ env.DOCKER_METADATA_OUTPUT_VERSION }} [skip ci]'