feat: labrinth argo

This commit is contained in:
Michael H.
2026-07-31 13:10:58 +02:00
parent 65a3ac4b34
commit 18b0b2848d
4 changed files with 67 additions and 41 deletions
+19
View File
@@ -0,0 +1,19 @@
name: Deploy Command
run-name: Deploy PR #${{ github.event.client_payload.github.payload.issue.number }}
on:
repository_dispatch:
types: [deploy-command]
jobs:
deploy:
uses: SparkUniverse/workflows/.github/workflows/deploy-command.yaml@main
secrets:
ARGOCD_DEPLOY_KEY: ${{ secrets.ARGOCD_DEPLOY_KEY }}
CMD_DISPATCH_GH_TOKEN: ${{ secrets.SLASH_CMD_GH_TOKEN }}
with:
application-set: labrinth
build-workflow: labrinth-build.yml
branch: ${{ github.event.client_payload.pull_request.head.ref }}
issue-number: ${{ github.event.client_payload.github.payload.issue.number }}
head-sha: ${{ github.event.client_payload.pull_request.head.sha }}
@@ -1,18 +1,18 @@
name: docker-build name: Labrinth Build
on: on:
push: push:
branches: branches:
- 'main' - 'main'
paths: paths:
- .github/workflows/labrinth-docker.yml - .github/workflows/labrinth-build.yml
- 'apps/labrinth/**' - 'apps/labrinth/**'
- Cargo.toml - Cargo.toml
- Cargo.lock - Cargo.lock
pull_request: pull_request:
types: [opened, synchronize] types: [opened, synchronize]
paths: paths:
- .github/workflows/labrinth-docker.yml - .github/workflows/labrinth-build.yml
- 'apps/labrinth/**' - 'apps/labrinth/**'
- Cargo.toml - Cargo.toml
- Cargo.lock - Cargo.lock
@@ -69,7 +69,8 @@ jobs:
echo "skip=false" >> $GITHUB_OUTPUT echo "skip=false" >> $GITHUB_OUTPUT
fi fi
docker: build:
name: Build Labrinth
runs-on: ${{ needs.skip-if-clean.outputs.internal == 'true' && 'namespace-profile-modrinth-labrinth' || 'ubuntu-latest' }} runs-on: ${{ needs.skip-if-clean.outputs.internal == 'true' && 'namespace-profile-modrinth-labrinth' || 'ubuntu-latest' }}
needs: [skip-if-clean] needs: [skip-if-clean]
if: ${{ needs.skip-if-clean.outputs.skip != 'true' }} if: ${{ needs.skip-if-clean.outputs.skip != 'true' }}
@@ -120,42 +121,30 @@ jobs:
cp -r apps/labrinth/migrations apps/labrinth/docker-stage/migrations cp -r apps/labrinth/migrations apps/labrinth/docker-stage/migrations
cp -r apps/labrinth/assets apps/labrinth/docker-stage/assets cp -r apps/labrinth/assets apps/labrinth/docker-stage/assets
- name: Set up Docker Buildx - name: Upload Docker context
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0 if: needs.skip-if-clean.outputs.internal == 'true'
uses: namespace-actions/upload-artifact@f6ccaacc655aec41b93af180d1d7eef21af862d2 # v1.0.3
- name: Generate Docker image metadata
id: docker-meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
env:
# GitHub Packages requires annotations metadata in at least the index descriptor to show them
# up properly in its UI it seems, but it's not clear about it, because the docs refer to the
# image manifest only. See:
# https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#adding-a-description-to-multi-arch-images
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
with: with:
images: ghcr.io/modrinth/labrinth name: labrinth-docker-context
labels: | retention-days: 1
org.opencontainers.image.title=labrinth path: apps/labrinth/docker-stage
org.opencontainers.image.description=Modrinth API
org.opencontainers.image.licenses=AGPL-3.0-only
annotations: |
org.opencontainers.image.title=labrinth
org.opencontainers.image.description=Modrinth API
org.opencontainers.image.licenses=AGPL-3.0-only
- name: Login to GitHub Packages docker-build:
uses: docker/login-action@abd2ef45e78c5afb21d64d4ca52ee8550d9572c7 # v4.5.1 needs: [skip-if-clean, build]
if: ${{ needs.skip-if-clean.outputs.internal == 'true' }}
uses: SparkUniverse/workflows/.github/workflows/docker-build.yaml@main
with: with:
registry: ghcr.io image-name: labrinth
username: ${{ github.actor }} dockerfile-path: apps/labrinth/Dockerfile
password: ${{ secrets.GITHUB_TOKEN }} artifacts-name: labrinth-docker-context
- name: Build and push deploy:
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0 needs: docker-build
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/prod' }}
uses: SparkUniverse/workflows/.github/workflows/argo-update.yaml@main
secrets:
ARGOCD_DEPLOY_KEY: ${{ secrets.ARGOCD_DEPLOY_KEY }}
with: with:
context: ./apps/labrinth/docker-stage application-set: labrinth
file: ./apps/labrinth/Dockerfile branch: ${{ github.ref == 'refs/heads/prod' && 'main' || 'develop' }}
push: true environment-name: ${{ github.ref == 'refs/heads/prod' && 'production' || 'staging' }}
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
annotations: ${{ steps.docker-meta.outputs.annotations }}
+18
View File
@@ -0,0 +1,18 @@
name: Slash Command Dispatch
on:
issue_comment:
types: [created]
jobs:
dispatch-command:
if: ${{ github.event.sender.type == 'User' && contains(fromJSON('["OWNER", "MEMBER"]'), github.event.comment.author_association) }}
runs-on: namespace-profile-tiny-arm64
steps:
- name: Slash Command Dispatch
uses: peter-evans/slash-command-dispatch@9bdcd7914ec1b75590b790b844aa3b8eee7c683a # v5.0.2
with:
token: ${{ secrets.SLASH_CMD_GH_TOKEN }}
issue-type: pull-request
commands: |
deploy
+1 -1
View File
@@ -11,7 +11,7 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates dumb-init curl \ && apt-get install -y --no-install-recommends ca-certificates dumb-init curl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
COPY labrinth /labrinth/labrinth COPY --chmod=0755 labrinth /labrinth/labrinth
COPY migrations /labrinth/migrations COPY migrations /labrinth/migrations
COPY assets /labrinth/assets COPY assets /labrinth/assets