chore: fix semantic-release #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- 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-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 }} | |
- 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 }}' |