Don't judge me #19
Workflow file for this run
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: Create a tag and publish a Docker image | |
on: | |
pull_request: | |
branches: | |
- main | |
types: closed | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
release_docker: | |
runs-on: [self-hosted,Linux,X64,gpu] | |
if: ${{ github.event.pull_request.merged && (contains(github.event.pull_request.labels.*.name, 'patch') || contains(github.event.pull_request.labels.*.name, 'minor') || contains(github.event.pull_request.labels.*.name, 'major')) }} | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Tag and prepare release | |
id: tag_and_prepare_release | |
uses: K-Phoen/[email protected] | |
with: | |
release_branch: main | |
release_strategy: tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | |
type=semver,pattern={{version}},value=${{ steps.tag_and_prepare_release.outputs.tag }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc | |
with: | |
context: . | |
target: "serving-prod" | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
release_ui: | |
runs-on: [self-hosted,Linux,X64,gpu] | |
if: ${{ github.event.pull_request.merged && (contains(github.event.pull_request.labels.*.name, 'docs') || contains(github.event.pull_request.labels.*.name, 'patch') || contains(github.event.pull_request.labels.*.name, 'minor') || contains(github.event.pull_request.labels.*.name, 'major')) }} | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Startup | |
run: docker-compose --env-file .env.ci up -d --build | |
- name: Wait for serving | |
run: docker-compose --env-file .env.ci exec develop koina_test.sh | |
- name: Update OpenAPI | |
run: docker-compose --env-file .env.ci exec develop koina_build_ui.sh | |
- name: Copy folder content recursively to remote | |
uses: garygrossgarten/github-action-scp@release | |
with: | |
local: web/.output/public | |
remote: /var/www/koina/ | |
host: ${{ secrets.WEBSERVER }} | |
username: ${{ secrets.SSH_USER }} | |
password: ${{ secrets.PASSWORD }} | |
- name: Shutdown | |
if: always() | |
run: docker-compose --env-file .env.ci down | |
- name: Cleanup | |
if: always() | |
run: docker-compose --env-file .env.ci rm |