feat: make deployment reusable

This commit is contained in:
ndsboy 2025-02-24 22:24:03 +00:00
parent 3cfa61aa2b
commit 498c07ce66
2 changed files with 15 additions and 10 deletions

View file

@ -2,25 +2,30 @@ name: deploy
on: [push, workflow_dispatch]
env:
repo: website
git: git.swablab.de
url: git.swablab.de/${{ github.repository }}
token: ${{ secrets.SWABLAB_ORGA_PACKAGE_TOKEN }}
ASTRO_TELEMETRY_DISABLED: true
STORAGE_DRIVER: vfs
jobs:
deploy:
name: deploy
runs-on: docker
if: github.ref == 'refs/heads/main'
container:
image: quay.io/buildah/stable:latest
if: github.ref == 'refs/heads/main'
env:
STORAGE_DRIVER: vfs
steps:
- name: download
run: curl ${{ github.server_url }}/${{ github.repository }}/archive/main.tar.gz | tar -xz
- name: login
run: buildah login -u token -p ${{ secrets.SWABLAB_ORGA_PACKAGE_TOKEN }} git.swablab.de
run: curl https://${{ env.url }}/archive/main.tar.gz | tar -xz
- name: build
run: buildah build -f website/Containerfile -t git.swablab.de/${{ github.repository }}:latest website
run: buildah build -f ${{ env.repo }}/Containerfile -t ${{ env.url }}:latest ${{ env.repo }}
- name: login
run: buildah login -u token -p ${{ env.token }} ${{ env.git }}
- name: push
run: buildah push git.swablab.de/${{ github.repository }}:latest
run: buildah push ${{ env.git }}/${{ github.repository }}:latest

View file

@ -4,9 +4,9 @@ ENV ASTRO_TELEMETRY_DISABLED=true
RUN deno task install
RUN deno task build
FROM ghcr.io/swablab/documents:latest AS documents
FROM git.swablab.de/swablab/documents AS documents
FROM docker.io/nginxinc/nginx-unprivileged:latest
FROM docker.io/nginxinc/nginx-unprivileged
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build ./dist /usr/share/nginx/html
COPY --from=documents / /usr/share/nginx/html/docs