mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-25 19:12:10 +03:00
a42d218962
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
166 lines
4.7 KiB
YAML
166 lines
4.7 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
env:
|
|
BUILD_TYPE: stable
|
|
APP_NAME: affine
|
|
COVERAGE: false
|
|
DISTRIBUTION: browser
|
|
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
|
|
|
jobs:
|
|
release:
|
|
name: Try publishing npm@latest release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Node.js
|
|
uses: ./.github/actions/setup-node
|
|
- name: Try publishing to NPM
|
|
run: ./scripts/publish.sh
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
|
|
build-core:
|
|
name: Build @affine/core
|
|
runs-on: ubuntu-latest
|
|
environment: development
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Node.js
|
|
uses: ./.github/actions/setup-node
|
|
- name: Build Plugins
|
|
run: yarn run build:plugins
|
|
- name: Build Core
|
|
run: yarn nx build @affine/core
|
|
- name: Upload core artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: core
|
|
path: ./packages/frontend/core/dist
|
|
if-no-files-found: error
|
|
|
|
build-server:
|
|
name: Build Server
|
|
runs-on: ubuntu-latest
|
|
environment: development
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Node.js
|
|
uses: ./.github/actions/setup-node
|
|
with:
|
|
electron-install: false
|
|
- name: Build Server
|
|
run: yarn nx build @affine/server
|
|
- name: Upload server dist
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: server-dist
|
|
path: ./packages/backend/server/dist
|
|
if-no-files-found: error
|
|
|
|
build-storage:
|
|
name: Build Storage
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
RUSTFLAGS: '-C debuginfo=1'
|
|
environment: development
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Setup Node.js
|
|
uses: ./.github/actions/setup-node
|
|
- name: Setup Rust
|
|
uses: ./.github/actions/build-rust
|
|
with:
|
|
target: 'x86_64-unknown-linux-gnu'
|
|
package: '@affine/storage'
|
|
nx_token: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
|
|
- name: Upload storage.node
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: storage.node
|
|
path: ./packages/backend/storage/storage.node
|
|
if-no-files-found: error
|
|
|
|
build-docker:
|
|
if: github.ref == 'refs/heads/master'
|
|
name: Build Docker
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- build-server
|
|
- build-core
|
|
- build-storage
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Download core artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: core
|
|
path: ./packages/frontend/core/dist
|
|
- name: Download server dist
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: server-dist
|
|
path: ./packages/backend/server/dist
|
|
- name: Download storage.node
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: storage.node
|
|
path: ./packages/backend/server
|
|
- name: Setup Git short hash
|
|
run: |
|
|
echo "GIT_SHORT_HASH=$(git rev-parse --short HEAD)" >> "$GITHUB_ENV"
|
|
- name: Login to GitHub Container Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
logout: false
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Build front Dockerfile
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
pull: true
|
|
platforms: linux/amd64,linux/arm64
|
|
provenance: true
|
|
file: .github/deployment/front/Dockerfile
|
|
tags: ghcr.io/toeverything/affine-front:${{ env.GIT_SHORT_HASH }},ghcr.io/toeverything/affine-front:latest
|
|
|
|
# setup node without cache configuration
|
|
# Prisma cache is not compatible with docker build cache
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
registry-url: https://npm.pkg.github.com
|
|
scope: '@toeverything'
|
|
|
|
- name: Install Node.js dependencies
|
|
run: yarn workspaces focus @affine/server --production
|
|
|
|
- name: Generate Prisma client
|
|
run: yarn workspace @affine/server prisma generate
|
|
|
|
- name: Build graphql Dockerfile
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
pull: true
|
|
platforms: linux/amd64,linux/arm64
|
|
provenance: true
|
|
file: .github/deployment/node/Dockerfile
|
|
tags: ghcr.io/toeverything/affine-graphql:${{ env.GIT_SHORT_HASH }},ghcr.io/toeverything/affine-graphql:latest
|