From fdd0210b1f3382a71c9d03a3cb406eeff2df4d57 Mon Sep 17 00:00:00 2001 From: AnnAngela Date: Sun, 2 Jul 2023 07:41:53 +0000 Subject: [PATCH] =?UTF-8?q?ci:=20=E4=BF=AE=E5=A4=8Ddocs=E5=8F=98=E5=8A=A8?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release-ota.yml | 35 +++++++++++++++---------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release-ota.yml b/.github/workflows/release-ota.yml index c70b7ea4e5..ee8ec0669a 100644 --- a/.github/workflows/release-ota.yml +++ b/.github/workflows/release-ota.yml @@ -150,34 +150,33 @@ jobs: - make-ota - make-ota-mac runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.MISTEOWORKFLOW }} steps: - name: Deploy the release run: | gh workflow --repo MaaAssistantArknights/MaaRelease run release-mirrors.yml - env: - GH_TOKEN: ${{ secrets.MISTEOWORKFLOW }} - - name: "Fetch MaaAssistantArknights" - uses: actions/checkout@v3 - name: Deploy the docs - env: - GH_TOKEN: ${{ secrets.MISTEOWORKFLOW }} run: | - git tag --list 'v*' --sort=-creatordate | head -n 2 > ${{ runner.temp }}/release_maa.txt + mkdir -p ${{ runner.temp }}/new + mkdir -p ${{ runner.temp }}/old + gh api /repos/MaaAssistantArknights/MaaAssistantArknights/tags --jq '.[].name' > ${{ runner.temp }}/release_maa.txt export NEW_VERSION=$(sed -n '1p' ${{ runner.temp }}/release_maa.txt) echo "NEW_VERSION: $NEW_VERSION" export OLD_VERSION=$(sed -n '2p' ${{ runner.temp }}/release_maa.txt) echo "OLD_VERSION: $OLD_VERSION" - git diff --name-only "$NEW_VERSION" "$OLD_VERSION" > ${{ runner.temp }}/diff - export DOCS_CHANGED=false - while IFS= read -r file; do - file=$(echo "$file" | sed 's/"//g') - if [[ $file == "docs/"* ]]; then - echo "Found docs changed: $file" - export DOCS_CHANGED=true - fi - done < ${{ runner.temp }}/diff - echo "DOCS_CHANGED: $DOCS_CHANGED" - if [ "$variable" = "true" ]; then + gh api "/repos/MaaAssistantArknights/MaaAssistantArknights/tarball/$NEW_VERSION" > ${{ runner.temp }}/new.tar.gz + gh api "/repos/MaaAssistantArknights/MaaAssistantArknights/tarball/$OLD_VERSION" > ${{ runner.temp }}/old.tar.gz + tar -xzf ${{ runner.temp }}/new.tar.gz -C ${{ runner.temp }}/new + tar -xzf ${{ runner.temp }}/old.tar.gz -C ${{ runner.temp }}/old + export NEW_PATH = "${{ runner.temp }}/new/$(ls ${{ runner.temp }}/new)/docs" + export OLD_PATH = "${{ runner.temp }}/old/$(ls ${{ runner.temp }}/old)/docs" + export DOCS_DIFF=$(diff -aqr $NEW_PATH $OLD_PATH) + if [ -n "$DOCS_DIFF" ]; then + echo "DOCS_DIFF:" + echo "$DOCS_DIFF" gh workflow --repo MaaAssistantArknights/maa-website run azure-deploy.yaml echo "Deploying the docs." + else + echo "DOCS_DIFF: $DOCS_DIFF" fi