chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程
|
||||
#
|
||||
name: Deploy VitePress site to Pages
|
||||
|
||||
on:
|
||||
# 在针对 `main` 分支的推送上运行。如果你
|
||||
# 使用 `master` 分支作为默认分支,请将其更改为 `master`
|
||||
push:
|
||||
branches: [master]
|
||||
|
||||
# 允许你从 Actions 选项卡手动运行此工作流程
|
||||
workflow_dispatch:
|
||||
|
||||
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
# 只允许同时进行一次部署,跳过正在运行和最新队列之间的运行队列
|
||||
# 但是,不要取消正在进行的运行,因为我们希望允许这些生产部署完成
|
||||
concurrency:
|
||||
group: pages
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
# 构建工作
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要
|
||||
- uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消注释
|
||||
with:
|
||||
version: 8
|
||||
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18
|
||||
cache: pnpm # 或 pnpm / yarn
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v4
|
||||
- name: Install dependencies
|
||||
run: pnpm install --no-frozen-lockfile # 或 pnpm install / yarn install / bun install
|
||||
- name: Build with VitePress
|
||||
run: pnpm docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: docs/.vitepress/dist
|
||||
|
||||
# 部署工作
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
name: Deploy
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
# https://github.com/actions/starter-workflows/blob/main/ci/python-publish.yml
|
||||
name: Doc Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branch: ['master']
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.8'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r doc/requirements.txt
|
||||
|
||||
- name: Build and publish
|
||||
run: |
|
||||
cd ./doc && make html && cd ../
|
||||
|
||||
- name: Deploy 🚀
|
||||
uses: JamesIves/github-pages-deploy-action@4.1.1
|
||||
with:
|
||||
branch: doc # The branch the action should deploy to.
|
||||
folder: doc/build/html # The folder the action should deploy.
|
||||
@@ -0,0 +1,71 @@
|
||||
# 参考
|
||||
# Build and push Docker images
|
||||
# https://github.com/marketplace/actions/build-and-push-docker-images
|
||||
# Docker Metadata action
|
||||
# https://github.com/marketplace/actions/docker-metadata-action
|
||||
# Multi-platform image with GitHub Actions
|
||||
# https://docs.docker.com/build/ci/github-actions/multi-platform/
|
||||
|
||||
name: Docker Publish
|
||||
|
||||
#on:
|
||||
# release:
|
||||
# types: [published]
|
||||
# push:
|
||||
# branch: ['master']
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: mouday/domain-admin
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'mouday/domain-admin-web'
|
||||
ref: 'dist'
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
path: 'domain_admin/public'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'mouday/domain-admin-mini'
|
||||
ref: 'dist'
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
path: 'domain_admin/public/m'
|
||||
|
||||
# remove .git
|
||||
- name: Remove .git Dir
|
||||
run: rm -rf '.git' 'domain_admin/public/.git' 'domain_admin/public/m/.git'
|
||||
|
||||
- name: Build Docker Image
|
||||
uses: docker/build-push-action@v2
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -0,0 +1,86 @@
|
||||
# https://github.com/actions/starter-workflows/blob/main/ci/python-publish.yml
|
||||
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/
|
||||
name: Upload Python Package
|
||||
|
||||
#on:
|
||||
# release:
|
||||
# types: [published]
|
||||
|
||||
#on:
|
||||
# push:
|
||||
# branch: ['master']
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: pypi
|
||||
url: https://pypi.org/p/domain-admin
|
||||
|
||||
permissions:
|
||||
# IMPORTANT: this permission is mandatory for trusted publishing
|
||||
id-token: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel twine
|
||||
|
||||
# 拉取前端最新的dist代码
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'mouday/domain-admin-web'
|
||||
ref: 'dist'
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
path: 'domain_admin/public'
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'mouday/domain-admin-mini'
|
||||
ref: 'dist'
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
path: 'domain_admin/public/m'
|
||||
|
||||
# remove .git
|
||||
- name: Remove .git Dir
|
||||
run: rm -rf '.git' 'domain_admin/public/.git' 'domain_admin/public/m/.git'
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
python setup.py sdist bdist_wheel --python-tag py2.py3
|
||||
twine check dist/*
|
||||
|
||||
# - name: Build and publish
|
||||
# if: startsWith(github.ref, 'refs/tags/')
|
||||
#
|
||||
# env:
|
||||
# TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
||||
# TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
||||
# run: |
|
||||
# python setup.py sdist bdist_wheel --python-tag py2.py3
|
||||
# twine check dist/*
|
||||
# twine upload dist/*
|
||||
# Publishing with a Trusted Publisher
|
||||
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
|
||||
# https://github.com/pypa/gh-action-pypi-publish/
|
||||
- name: Publish package distributions to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
@@ -0,0 +1,104 @@
|
||||
#https://github.com/yyx990803/release-tag
|
||||
|
||||
name: Create Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
|
||||
|
||||
#on:
|
||||
# push:
|
||||
# branch: ['master']
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Create Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Master
|
||||
uses: actions/checkout@master
|
||||
|
||||
# 拉取web前端dist的代码
|
||||
- name: Checkout Web Dist
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'mouday/domain-admin-web'
|
||||
ref: 'dist'
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
path: 'domain_admin/public'
|
||||
|
||||
- name: Checkout Mini Dist
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'mouday/domain-admin-mini'
|
||||
ref: 'dist'
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
path: 'domain_admin/public/m'
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v3
|
||||
with:
|
||||
python-version: '3.x'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel twine
|
||||
|
||||
- name: Build Dist
|
||||
run: |
|
||||
python setup.py sdist bdist_wheel --python-tag py2.py3
|
||||
|
||||
# 拉取前端最新的master代码
|
||||
- name: Checkout Web Master
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'mouday/domain-admin-web'
|
||||
ref: 'master'
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
path: 'domain_admin_web'
|
||||
|
||||
# https://github.com/a7ul/tar-action
|
||||
# https://docs.github.com/zh/actions/learn-github-actions/contexts#github-context
|
||||
- name: Compress action step Web
|
||||
uses: a7ul/tar-action@v1.1.0
|
||||
id: compress-web
|
||||
with:
|
||||
command: c
|
||||
cwd: ./
|
||||
files: |
|
||||
./domain_admin_web
|
||||
outPath: ./dist/domain-admin-web-${{github.ref_name}}.tar.gz
|
||||
|
||||
# 拉取H5前端最新的master代码
|
||||
- name: Checkout Mini Master
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: 'mouday/domain-admin-mini'
|
||||
ref: 'master'
|
||||
token: ${{ secrets.GH_PAT }}
|
||||
path: 'domain_admin_mini'
|
||||
|
||||
# remove .git
|
||||
- name: Remove .git Dir
|
||||
run: rm -rf '.git' 'domain_admin/public/.git' 'domain_admin/public/m/.git'
|
||||
|
||||
- name: Compress action step Mini
|
||||
uses: a7ul/tar-action@v1.1.0
|
||||
id: compress-mini
|
||||
with:
|
||||
command: c
|
||||
cwd: ./
|
||||
files: |
|
||||
./domain_admin_mini
|
||||
outPath: ./dist/domain-admin-mini-${{github.ref_name}}.tar.gz
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
files: ./dist/*
|
||||
body: Please refer to [CHANGELOG.md](https://domain-admin.readthedocs.io/zh_CN/latest/manual/changelog.html) for details.
|
||||
# note you'll typically need to create a personal access token
|
||||
# with permissions to create releases in the other repo
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Upstream Sync
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sync_with_upstream:
|
||||
name: Sync with Upstream
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.repository.fork }}
|
||||
|
||||
steps:
|
||||
- name: Checkout target repo
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Sync Upstream
|
||||
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
|
||||
with:
|
||||
target_repo_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
upstream_sync_repo: dromara/domain-admin
|
||||
upstream_sync_branch: master
|
||||
target_sync_branch: master
|
||||
test_mode: false
|
||||
|
||||
- name: Check for Failure
|
||||
if: failure()
|
||||
run: |
|
||||
echo "[Error] Due to a change in the workflow file of the upstream repository, GitHub has automatically suspended the scheduled automatic update. You need to manually sync your fork."
|
||||
exit 1
|
||||
@@ -0,0 +1,57 @@
|
||||
# 测试
|
||||
# doc: https://docs.github.com/zh/actions/automating-builds-and-tests/building-and-testing-python
|
||||
# https://github.com/actions/python-versions
|
||||
# https://github.com/actions/python-versions/blob/main/versions-manifest.json
|
||||
|
||||
name: Run tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
pull_request:
|
||||
branches:
|
||||
- "master"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
# Run in all these versions of Python
|
||||
python-version: ["3.8", "3.9", "3.10", "3.11"]
|
||||
# 排除版本
|
||||
exclude:
|
||||
- os: ubuntu-latest
|
||||
python-version: "3.5"
|
||||
- os: macos-latest
|
||||
python-version: "3.5"
|
||||
- os: macos-latest
|
||||
python-version: "3.7"
|
||||
|
||||
steps:
|
||||
# Checkout the latest code from the repo
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v3
|
||||
# Setup which version of Python to use
|
||||
- name: Set Up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
# Display the Python version being used
|
||||
- name: Display Python version
|
||||
run: python -c "import sys; print(sys.version)"
|
||||
# Install pytest (you can use some other testing utility)
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements/development.txt
|
||||
# Install the package using the setup.py
|
||||
- name: Install package
|
||||
run: python setup.py install
|
||||
# Run the tests. I'm using pytest and the file is in the tests directory.
|
||||
- name: Run tests
|
||||
# run: pytest -c pytest.ini tests/api/test_index.py
|
||||
run: python -m unittest tests/test_hello.py
|
||||
Reference in New Issue
Block a user