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

96 lines
2.7 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:
2024-08-31 20:27:36 +03:00
bunny_version: v0.1.0
2024-09-03 15:40:23 +03:00
base_path: ./
2024-08-31 14:47:33 +03:00
permissions:
checks: write
contents: write
packages: write
pull-requests: read
jobs:
2024-09-03 15:40:23 +03:00
build:
name: Build
runs-on: ubuntu-latest
2024-08-31 14:47:33 +03:00
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-09-03 15:40:23 +03:00
- uses: actions/setup-node@v4
2024-08-31 14:47:33 +03:00
with:
2024-09-03 15:41:38 +03:00
node-version: lts/*
2024-09-03 15:40:23 +03:00
cache: yarn
- name: Install dependencies
run: yarn install --immutable --network-timeout=300000
- name: Set version into manifest.json
2024-09-06 00:20:37 +03:00
run: |
2024-09-14 21:09:58 +03:00
TAG=$(git describe --tags --abbrev=0 || echo "latest")
sed -i "s|\"icons\"|\"version\": \"$TAG\",\\n \"icons\"|g" public/manifest.json
2024-09-03 15:40:23 +03:00
- name: Build
run: yarn build --base=${{ env.base_path }}
- uses: actions/upload-artifact@v4
2024-08-31 14:47:33 +03:00
with:
2024-09-03 15:40:23 +03:00
path: dist/
2024-09-14 21:09:58 +03:00
name: dist
2024-09-03 15:40:23 +03:00
if-no-files-found: error
retention-days: 1
compression-level: 0
overwrite: true
include-hidden-files: true
2024-09-03 15:55:29 +03:00
2024-09-03 15:40:23 +03:00
docker:
name: Docker
needs: build
runs-on: self-hosted
2024-08-31 20:27:36 +03:00
steps:
- uses: actions/checkout@v4
2024-09-03 15:40:23 +03:00
- uses: actions/download-artifact@v4
with:
2024-09-14 21:09:58 +03:00
name: dist
2024-09-03 15:44:50 +03:00
path: dist/
- 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' }}
2024-09-14 21:09:58 +03:00
type=semver,pattern={{raw}}
- name: Build and push
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2024-09-03 15:55:29 +03:00
cdn:
name: CDN
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
2024-09-03 15:55:29 +03:00
- uses: actions/download-artifact@v4
with:
2024-09-14 21:09:58 +03:00
name: dist
2024-09-03 15:55:29 +03:00
path: dist/
- 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