synapse-admin/.github/workflows/workflow.yml

66 lines
2.1 KiB
YAML
Raw Normal View History

2024-08-31 20:27:36 +03:00
name: CI
2024-08-31 14:47:33 +03:00
on:
push:
branches: [ "main" ]
env:
upstream_version: v0.10.3
etke_version: etke1
2024-08-31 20:27:36 +03:00
bunny_version: v0.1.0
2024-08-31 14:47:33 +03:00
permissions:
checks: write
contents: write
packages: write
pull-requests: read
jobs:
build-publish:
name: Build and Publish
runs-on: self-hosted
steps:
2024-08-31 14:57:07 +03:00
- uses: actions/checkout@v4
2024-08-31 15:00:10 +03:00
with:
fetch-depth: 0
2024-08-31 14:47:33 +03:00
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
registry.etke.cc/${{ github.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
type=raw,value=${{ env.upstream_version }}-${{ env.etke_version }},enable=${{ github.ref_name == 'main' }}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
2024-08-31 14:54:52 +03:00
context: .
2024-08-31 14:47:33 +03:00
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2024-08-31 20:27:36 +03:00
build-deploy:
name: Build and Release
needs: build-publish
runs-on: ubuntu-latest
container: ghcr.io/${{ github.repository }} # as this job depends on the build-publish and build-publish always publishes the latest tag
steps:
- uses: actions/checkout@v4
- name: Configure
run: |
cp ./config.json /app/config.json
mv /app ./public
- name: Upload
run: |
wget -O bunny-upload.tar.gz https://github.com/etkecc/bunny-upload/releases/download/${{ env.bunny_version }}/bunny-upload_Linux_x86_64.tar.gz
tar -xzf bunny-upload.tar.gz
echo "${{ secrets.BUNNY_CONFIG }}" > bunny-config.yaml
./bunny-upload -c bunny-config.yaml