Pārlūkot izejas kodu

workflow: add asset repo sync

wangweimin 4 gadi atpakaļ
vecāks
revīzija
d83025d29e
1 mainītis faili ar 22 papildinājumiem un 2 dzēšanām
  1. 22 2
      .github/workflows/release.yml

+ 22 - 2
.github/workflows/release.yml

@@ -1,4 +1,4 @@
-name: Release to PyPi
+name: Release
 
 on:
   create:
@@ -25,11 +25,31 @@ jobs:
           npm install
           gulp
           cp dist/pywebio.min.js ../pywebio/html/js
-      - run: |
+      - name: PyPi Upload
+        run: |
           pip3 install twine
           python3 setup.py sdist
           twine upload --username "__token__" --disable-progress-bar --verbose dist/*
         env:
           TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
+      - name: Set tag
+        run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
+      - name: Push asset
+        run: |
+          git config --global user.email "wang0.618@qq.com"
+          git config --global user.name "${{ github.actor }}"
+          git config --global credential.helper '!f() { sleep 1; echo "username=${{ github.actor }}"; echo "password=${GH_TOKEN}"; }; f'
 
+          git clone https://github.com/wang0618/pywebio-assets.git
+          rm -rf pywebio-asset/*
+          cp -r pywebio/html/* pywebio-asset
 
+          cd pywebio-asset
+          git add .
+          git commit -m "Build from https://github.com/wang0618/PyWebIO/commit/$GITHUB_SHA"
+          git tag $RELEASE_VERSION
+
+          git push -f -u origin --tags || exit 0
+          git push -f -u origin || exit 0
+        env:
+          GH_TOKEN: ${{ secrets.ASSET_REPO_TOKEN }}