feat: ai加上国际化的Provider #7215
Workflow file for this run
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: Test, Build and Publish Projects | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [master] | |
push: | |
tags: | |
- "v**" | |
- "ai-beta.**" | |
branches: | |
- master | |
concurrency: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
GITHUB_CR: ghcr.io | |
# ALIYUN_CR: registry.cn-hangzhou.aliyuncs.com | |
# ALIYUN_PROJECT_NAME: scow | |
jobs: | |
test-version-packages: | |
name: Test and version packages | |
runs-on: ${{ vars.ACTION_RUNNER_LABEL }} | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# changelog generation requires full history | |
# to track each changelog file to its submission commit | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: pnpm/action-setup@v4.0.0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
cache: pnpm | |
- name: Install dependencies | |
run: pnpm i --frozen-lockfile | |
- name: Prepare dev libs and code | |
run: pnpm prepareDev | |
- name: Lint code | |
run: pnpm lint | |
- name: Generate SSH key pairs for test | |
if: vars.RUN_TESTS == 'true' | |
run: ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N "" | |
- name: Start dev env for db testing | |
if: vars.RUN_TESTS == 'true' | |
run: pnpm devenv | |
- name: Check running containers | |
if: vars.RUN_TESTS == 'true' | |
run: docker ps | |
- name: Wait for ports | |
if: vars.RUN_TESTS == 'true' | |
uses: ifaxity/wait-on-action@v1.2.1 | |
with: | |
log: true | |
verbose: true | |
resource: "tcp:localhost:3306 tcp:localhost:6379 tcp:localhost:389 tcp:localhost:6000 tcp:localhost:6001 tcp:localhost:6002" | |
- name: Run tests | |
if: vars.RUN_TESTS == 'true' | |
run: pnpm test:ci | |
- name: Upload test converage | |
uses: codecov/codecov-action@v4 | |
if: vars.RUN_TESTS == 'true' | |
with: | |
files: ./libs/auth/coverage/lcov.info,./libs/ssh/coverage/lcov.info,./libs/libconfig/coverage/lcov.info,./libs/decimal/coverage/lcov.info,./libs/server/coverage/lcov.info,./apps/cli/coverage/lcov.info,./apps/auth/coverage/lcov.info,./apps/mis-server/coverage/lcov.info,./apps/portal-server/coverage/lcov.info,./apps/gateway/coverage/lcov.info,./apps/audit-server/coverage/lcov.info | |
- name: Create Release Pull Request or Publish | |
id: changesets | |
uses: changesets/action@v1 | |
if: vars.RUN_RELEASE == 'true' && github.ref == 'refs/heads/master' | |
with: | |
version: pnpm ci:version | |
publish: pnpm ci:publish | |
createGithubReleases: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
scow-cli: | |
needs: test-version-packages | |
runs-on: ${{ vars.ACTION_RUNNER_LABEL }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4.0.0 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: pnpm | |
- name: Install dependencies for scow-cli | |
run: pnpm i --frozen-lockfile --filter @scow/cli... | |
- name: Build scow-cli | |
run: pnpm build "--filter=@scow/cli" | |
- name: Archive scow-cli-x64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: scow-cli-x64 | |
path: apps/cli/exe/cli-x64 | |
- name: Archive scow-cli-arm64 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: scow-cli-arm64 | |
path: apps/cli/exe/cli-arm64 | |
build-images: | |
needs: test-version-packages | |
runs-on: ${{ vars.ACTION_RUNNER_LABEL }} | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
include: | |
- name: scow | |
file: scow | |
build_args: "" | |
- name: docs | |
file: docs | |
build_args: BASE_PATH=/SCOW/ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the GitHub Container registry | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 | |
with: | |
registry: ${{ env.GITHUB_CR }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.GITHUB_CR }}/${{ github.repository }}/${{ matrix.name }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
build-args: ${{ matrix.build_args }} | |
tags: ${{ steps.meta.outputs.tags }} | |
file: docker/Dockerfile.${{ matrix.file }} | |
labels: ${{ steps.meta.outputs.labels }} | |
# only build arm64 in tag commits or branches with name starting with `arm-` | |
platforms: linux/amd64${{ (github.ref_type == 'tag' || startsWith(github.ref_name, 'arm-')) && ',linux/arm64' || '' }} | |
release: | |
runs-on: ${{ vars.ACTION_RUNNER_LABEL }} | |
needs: | |
- scow-cli | |
- build-images | |
if: github.ref_type == 'tag' | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download cli-x64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: scow-cli-x64 | |
path: release/scow-cli | |
- name: Download cli-arm64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: scow-cli-arm64 | |
path: release/scow-cli | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: release | |
- name: Create release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: SCOW ${{ startsWith(github.ref_name, 'ai-') && format('AI Beta {0}', github.ref_name) || github.ref_name }} | |
body_path: ${{ !startsWith(github.ref_name, 'ai-') && format('changelogs/{0}.md', github.ref_name) || null }} | |
generate_release_notes: ${{ startsWith(github.ref_name, 'ai-') }} | |
prerelease: ${{ startsWith(github.ref_name, 'ai-') }} | |
files: | | |
release/scow-cli/cli-x64 | |
release/scow-cli/cli-arm64 | |
- name: Send Notification Request | |
run: | | |
curl -X POST ${{ secrets.RELEASE_SERVICE_ADDRESS }}/version/success \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: Bearer ${{ secrets.RELEASE_API_KEY }}" |