Skip to content

Update image to sha-4caf0b1 #175

Update image to sha-4caf0b1

Update image to sha-4caf0b1 #175

Workflow file for this run

name: build
on:
push:
branches:
- "main"
workflow_dispatch:
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: ci-install token
id: cicd
uses: getsentry/action-github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Semantic Release
id: semantic_release
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ steps.cicd.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Set default (old) release version
run: echo "RELEASE_VERSION=${{ steps.semantic_release.outputs.last_release_version }}" >> $GITHUB_ENV
- name: Set new release version
run: echo "RELEASE_VERSION=${{ steps.semantic_release.outputs.new_release_version }}" >> $GITHUB_ENV
if: steps.semantic_release.outputs.new_release_published == 'true'
outputs:
new_release_published: ${{ steps.semantic_release.outputs.new_release_published }}
new_release_version: ${{ steps.semantic_release.outputs.new_release_version }}
last_release_version: ${{ steps.semantic_release.outputs.last_release_version }}
release_version: ${{ env.RELEASE_VERSION }}
build:
needs: release
runs-on: ubuntu-latest
steps:
- name: ci-install token
id: cicd
uses: getsentry/action-github-app-token@v2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- 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-ui
# 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 }}
- name: Update yaml
uses: fjogeleit/yaml-update-action@main
with:
token: ${{ steps.cicd.outputs.token }}
valueFile: 'k8s/deployment-dev.yaml'
propertyPath: 'spec.template.spec.containers[0].image'
value: ghcr.io/fhswf/openai-ui:${{ env.DOCKER_METADATA_OUTPUT_VERSION }}
branch: main
message: 'Update image to ${{ env.DOCKER_METADATA_OUTPUT_VERSION }}'