-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (70 loc) · 2.22 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Publish
on:
workflow_dispatch:
permissions:
contents: write
jobs:
publish-npm:
runs-on: ubuntu-latest
outputs:
server_updated: ${{ steps.publish.outputs.server_updated }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(corepack yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: corepack yarn
- name: Build packages
run: corepack yarn all:build
- name: Setup Yarn
run: corepack yarn config set -H 'npmAuthToken' "${{ secrets.NPM_TOKEN }}"
- name: Publish and commit
id: publish
run: corepack yarn zx scripts/publish.mjs
- name: Upload server tgz
uses: actions/upload-artifact@v4
if: steps.publish.outputs.server_updated == 'true'
with:
name: server
path: apps/server/package.tgz
publish-docker-server:
runs-on: ubuntu-latest
needs: publish-npm
if: needs.publish-npm.outputs.server_updated == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download server tgz
uses: actions/download-artifact@v4
with:
name: server
path: apps/server
- name: Log in to Aliyun Container Registry
uses: docker/login-action@v2
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ACR_USER }}
password: ${{ secrets.ACR_PASS }}
- name: Build and push server Docker image
uses: docker/build-push-action@v4
with:
push: true
context: '.'
file: './docker/dockerfiles/server.dockerfile'
tags: |
registry.cn-hangzhou.aliyuncs.com/aoi-js/server:latest