Publish #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 workspaces foreach -Apt run 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 |