1
mirror of https://github.com/CarmJos/MineSQL.git synced 2026-06-05 00:48:16 +08:00

ci(deploy): 支持三处同时部署

This commit is contained in:
2022-12-19 18:46:38 +08:00
parent 2321ed35c2
commit 5ecd7f54e2
10 changed files with 130 additions and 15 deletions
+75 -1
View File
@@ -8,7 +8,7 @@ on:
types: [ published ]
jobs:
gh-deploy:
packages-deploy:
name: "Deploy Project (GitHub)"
runs-on: ubuntu-latest
@@ -43,6 +43,80 @@ jobs:
asset_path: ".asset/*.jar"
asset_content_type: application/java-archive
github-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: "Set up JDK"
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: "Maven Deploy"
run: mvn -B -Plocal deploy --file pom.xml -DskipTests
- name: "Copy artifacts"
run: |
rm -rf deploy
mkdir -vp deploy
cp -vrf $HOME/local-deploy/* deploy/
cp -vrf .documentation/repository/REPO-README.md deploy/README.md
- name: "Copy Javadoc"
run: |
rm -rf docs
mkdir -vp docs
cp -vrf api/target/apidocs/* docs/
cp -vrf .documentation/javadoc/JAVADOC-README.md docs/README.md
- name: "Generate Javadoc sitemap"
id: sitemap
uses: cicirello/generate-sitemap@v1
with:
base-url-path: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
path-to-root: docs
- name: "Output Javadoc stats"
run: |
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
ls -l docs
- name: "Configure Git"
env:
DEPLOY_PRI: ${{secrets.DEPLOY_PRI}}
run: |
sudo timedatectl set-timezone "Asia/Shanghai"
mkdir -p ~/.ssh/
echo "$DEPLOY_PRI" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git config --global user.name '${{ github.repository_owner }}'
git config --global user.email '${{ github.repository_owner }}@users.noreply.github.com'
- name: "Commit&Push repository files"
run: |
cd deploy
git init
git remote add origin git@github.com:${{ github.repository_owner }}/${{ github.event.repository.name }}.git
git checkout -b repo
git add -A
git commit -m "Maven project deployment."
git push origin HEAD:repo --force
- name: "Commit&Push API documentation"
run: |
cd docs
git init
git remote add origin git@github.com:${{ github.repository_owner }}/${{ github.event.repository.name }}.git
git checkout -b gh-pages
git add -A
git commit -m "API Document generated."
git push origin HEAD:gh-pages --force
central-deploy:
name: "Deploy Project (Central)"
runs-on: ubuntu-latest