|
@@ -144,10 +144,10 @@ jobs:
|
|
|
GH_USER: ${{ secrets.GIT_USER }}
|
|
GH_USER: ${{ secrets.GIT_USER }}
|
|
|
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
|
|
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
|
|
|
|
|
|
|
|
- deploy_to_cloudflare_pages:
|
|
|
|
|
|
|
+ deploy:
|
|
|
needs:
|
|
needs:
|
|
|
- build
|
|
- build
|
|
|
- name: Deploy to Cloudflare Pages
|
|
|
|
|
|
|
+ name: Deploy
|
|
|
if: github.ref == 'refs/heads/master'
|
|
if: github.ref == 'refs/heads/master'
|
|
|
runs-on: ubuntu-slim
|
|
runs-on: ubuntu-slim
|
|
|
# matrix is a tricky way to define a variable directly in the action yaml
|
|
# matrix is a tricky way to define a variable directly in the action yaml
|
|
@@ -171,58 +171,51 @@ jobs:
|
|
|
with:
|
|
with:
|
|
|
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
|
name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
|
|
path: public
|
|
path: public
|
|
|
- - uses: cloudflare/wrangler-action@v3
|
|
|
|
|
|
|
+ - name: Prepare GitHub Pages deployment marker
|
|
|
|
|
+ id: deploy_marker
|
|
|
|
|
+ run: |
|
|
|
|
|
+ echo "marker_file=deploy-check-${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}.txt" >> $GITHUB_OUTPUT
|
|
|
|
|
+ # Deploy to Cloudflare, GitLab, and GitHub in parallel
|
|
|
|
|
+ - name: Deploy to Cloudflare Pages
|
|
|
|
|
+ id: deploy_cloudflare
|
|
|
|
|
+ uses: cloudflare/wrangler-action@v3
|
|
|
|
|
+ background: true
|
|
|
with:
|
|
with:
|
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
command: pages deploy public --project-name=sukkaw-ruleset --commit-dirty=true --branch=main
|
|
command: pages deploy public --project-name=sukkaw-ruleset --commit-dirty=true --branch=main
|
|
|
wranglerVersion: ${{ matrix.wranglerVersion }}
|
|
wranglerVersion: ${{ matrix.wranglerVersion }}
|
|
|
-
|
|
|
|
|
- deploy_to_github_gitlab:
|
|
|
|
|
- needs:
|
|
|
|
|
- - build
|
|
|
|
|
- name: Deploy to GitHub and GitLab
|
|
|
|
|
- if: github.ref == 'refs/heads/master'
|
|
|
|
|
- runs-on: ubuntu-slim
|
|
|
|
|
- steps:
|
|
|
|
|
- - uses: actions/download-artifact@v8
|
|
|
|
|
- with:
|
|
|
|
|
- name: build-artifact-${{ github.sha }}-${{ github.run_number }}
|
|
|
|
|
- path: public
|
|
|
|
|
- name: Upload Dist to GitLab
|
|
- name: Upload Dist to GitLab
|
|
|
- continue-on-error: true
|
|
|
|
|
|
|
+ id: deploy_gitlab
|
|
|
|
|
+ background: true
|
|
|
run: |
|
|
run: |
|
|
|
- git clone --filter=tree:0 --no-tags https://${GITLAB_TOKEN_NAME}:${GITLAB_TOKEN}@gitlab.com/SukkaW/ruleset.skk.moe.git ./deploy-git
|
|
|
|
|
- cd ./deploy-git
|
|
|
|
|
- git config --global push.dgefault matching
|
|
|
|
|
- git config --global user.email "${GITLAB_EMAIL}"
|
|
|
|
|
- git config --global user.name "${GITLAB_USER}"
|
|
|
|
|
|
|
+ git clone --filter=tree:0 --no-tags https://${GITLAB_TOKEN_NAME}:${GITLAB_TOKEN}@gitlab.com/SukkaW/ruleset.skk.moe.git ./deploy-git-gitlab
|
|
|
|
|
+ cd ./deploy-git-gitlab
|
|
|
|
|
+ git config push.default matching
|
|
|
|
|
+ git config user.email "${GITLAB_EMAIL}"
|
|
|
|
|
+ git config user.name "${GITLAB_USER}"
|
|
|
rm -rf ./*
|
|
rm -rf ./*
|
|
|
cp -rf ../public/* ./
|
|
cp -rf ../public/* ./
|
|
|
git add --all .
|
|
git add --all .
|
|
|
git commit -m "deploy: https://github.com/SukkaW/Surge/commit/${GITHUB_SHA}"
|
|
git commit -m "deploy: https://github.com/SukkaW/Surge/commit/${GITHUB_SHA}"
|
|
|
git push --quiet --force origin HEAD:master
|
|
git push --quiet --force origin HEAD:master
|
|
|
cd ..
|
|
cd ..
|
|
|
- rm -rf ./deploy-git
|
|
|
|
|
|
|
+ rm -rf ./deploy-git-gitlab
|
|
|
env:
|
|
env:
|
|
|
GITLAB_EMAIL: ${{ secrets.GITLAB_EMAIL }}
|
|
GITLAB_EMAIL: ${{ secrets.GITLAB_EMAIL }}
|
|
|
GITLAB_USER: ${{ secrets.GITLAB_USER }}
|
|
GITLAB_USER: ${{ secrets.GITLAB_USER }}
|
|
|
GITLAB_TOKEN_NAME: ${{ secrets.GITLAB_TOKEN_NAME }}
|
|
GITLAB_TOKEN_NAME: ${{ secrets.GITLAB_TOKEN_NAME }}
|
|
|
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
|
|
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
|
|
|
- - name: Prepare GitHub Pages deployment marker
|
|
|
|
|
- id: deploy_marker
|
|
|
|
|
- run: |
|
|
|
|
|
- echo "marker_file=deploy-check-${GITHUB_SHA}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}.txt" >> $GITHUB_OUTPUT
|
|
|
|
|
- name: Upload Dist to GitHub
|
|
- name: Upload Dist to GitHub
|
|
|
id: upload_dist_to_github
|
|
id: upload_dist_to_github
|
|
|
- continue-on-error: true
|
|
|
|
|
|
|
+ background: true
|
|
|
run: |
|
|
run: |
|
|
|
gh repo unarchive SukkaLab/ruleset.skk.moe --yes
|
|
gh repo unarchive SukkaLab/ruleset.skk.moe --yes
|
|
|
- git clone --filter=tree:0 --no-tags https://${GH_USER}:${GH_TOKEN}@github.com/SukkaLab/ruleset.skk.moe.git ./deploy-git
|
|
|
|
|
- cd ./deploy-git
|
|
|
|
|
- git config --global push.default matching
|
|
|
|
|
- git config --global user.email "${GH_EMAIL}"
|
|
|
|
|
- git config --global user.name "${GH_USER}"
|
|
|
|
|
|
|
+ git clone --filter=tree:0 --no-tags https://${GH_USER}:${GH_TOKEN}@github.com/SukkaLab/ruleset.skk.moe.git ./deploy-git-github
|
|
|
|
|
+ cd ./deploy-git-github
|
|
|
|
|
+ git config push.default matching
|
|
|
|
|
+ git config user.email "${GH_EMAIL}"
|
|
|
|
|
+ git config user.name "${GH_USER}"
|
|
|
rm -rf ./*
|
|
rm -rf ./*
|
|
|
cp -rf ../public/* ./
|
|
cp -rf ../public/* ./
|
|
|
echo "ruleset-mirror.skk.moe" > CNAME
|
|
echo "ruleset-mirror.skk.moe" > CNAME
|
|
@@ -231,11 +224,12 @@ jobs:
|
|
|
git commit -m "deploy: https://github.com/SukkaW/Surge/commit/${GITHUB_SHA}"
|
|
git commit -m "deploy: https://github.com/SukkaW/Surge/commit/${GITHUB_SHA}"
|
|
|
git push --quiet --force origin HEAD:master
|
|
git push --quiet --force origin HEAD:master
|
|
|
cd ..
|
|
cd ..
|
|
|
- rm -rf ./deploy-git
|
|
|
|
|
|
|
+ rm -rf ./deploy-git-github
|
|
|
env:
|
|
env:
|
|
|
GH_EMAIL: ${{ secrets.GIT_EMAIL }}
|
|
GH_EMAIL: ${{ secrets.GIT_EMAIL }}
|
|
|
GH_USER: ${{ secrets.GIT_USER }}
|
|
GH_USER: ${{ secrets.GIT_USER }}
|
|
|
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
|
|
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
|
|
|
|
|
+ - wait: upload_dist_to_github
|
|
|
- name: Wait for GitHub Pages to serve deployed marker
|
|
- name: Wait for GitHub Pages to serve deployed marker
|
|
|
if: steps.upload_dist_to_github.outcome == 'success'
|
|
if: steps.upload_dist_to_github.outcome == 'success'
|
|
|
id: wait_for_github_pages
|
|
id: wait_for_github_pages
|
|
@@ -259,10 +253,10 @@ jobs:
|
|
|
gh repo archive SukkaLab/ruleset.skk.moe --yes
|
|
gh repo archive SukkaLab/ruleset.skk.moe --yes
|
|
|
env:
|
|
env:
|
|
|
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
|
|
GH_TOKEN: ${{ secrets.GIT_TOKEN }}
|
|
|
|
|
+ - wait-all:
|
|
|
remove_artifacts:
|
|
remove_artifacts:
|
|
|
needs:
|
|
needs:
|
|
|
- - deploy_to_cloudflare_pages
|
|
|
|
|
- - deploy_to_github_gitlab
|
|
|
|
|
|
|
+ - deploy
|
|
|
name: Remove Artifacts after Deployment
|
|
name: Remove Artifacts after Deployment
|
|
|
runs-on: ubuntu-slim
|
|
runs-on: ubuntu-slim
|
|
|
steps:
|
|
steps:
|