tei.su/.forgejo/workflows/publish.yaml

57 lines
1.5 KiB
YAML
Raw Normal View History

2024-08-04 01:56:50 +03:00
name: Publish and deploy
2024-08-03 06:30:05 +03:00
on:
push:
branches: [ main ]
2024-08-04 01:56:50 +03:00
workflow_dispatch:
2025-01-04 02:50:49 +03:00
2024-08-04 01:56:50 +03:00
concurrency:
group: deploy
cancel-in-progress: true
2024-08-03 06:30:05 +03:00
jobs:
2024-08-04 01:56:50 +03:00
publish:
if: github.repository == 'teidesu/tei.su' # do not run on forks
2025-01-16 03:24:54 +03:00
runs-on: buildkit
2024-08-03 06:30:05 +03:00
permissions:
contents: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare
env:
2025-01-16 03:24:54 +03:00
DONATE_PAGE_DATA: ${{ vars.DONATE_PAGE_DATA }}
run: echo "$DONATE_PAGE_DATA" > src/components/pages/PageDonate/data.json
2024-08-03 06:30:05 +03:00
- name: Login to GitHub Container Registry
2025-01-16 03:24:54 +03:00
run: /opt/registry-login.sh git.stupid.fish "${{ github.actor }}" "${{ secrets.PACKAGES_PAT }}"
2024-08-03 06:30:05 +03:00
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
2025-01-04 02:50:49 +03:00
images: git.stupid.fish/teidesu/tei.su
2024-08-03 06:30:05 +03:00
tags: type=sha
flavor: latest=true
2025-01-16 03:24:54 +03:00
sep-tags: ',name='
2024-08-03 06:30:05 +03:00
- name: Build and push
2025-01-16 03:24:54 +03:00
run: |
buildctl build \
--frontend dockerfile.v0 \
--local context=. \
--local dockerfile=. \
--opt platform=amd64 \
--output type=image,oci-mediatypes=true,compression=zstd,rewrite-timestamp=true,push=true,name=${{ steps.meta.outputs.tags }}
2024-08-04 01:56:50 +03:00
deploy:
2025-01-04 02:50:49 +03:00
runs-on: node22
2024-08-04 01:56:50 +03:00
needs: publish
steps:
2025-01-04 02:50:49 +03:00
- uses: https://github.com/teidesu/desu-deploy@main
2024-08-04 01:56:50 +03:00
with:
2025-01-04 02:50:49 +03:00
key: ${{ secrets.DESU_DEPLOY_KEY }}
server: ${{ secrets.KOI_IP }}
2024-08-04 01:56:50 +03:00
service: teisu