From 7008ca3127d647ca715259013d73abbbe6f37ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B0=8F=E7=99=BD?= <296015668@qq.com> Date: Mon, 29 Apr 2024 14:19:34 +0800 Subject: [PATCH] feat: remove gitea --- .github/workflows/release.yml | 23 +++++++++++++---- .../workflows/{sync-gitea.yml => sync.yml} | 25 ++++++++++++++----- 2 files changed, 37 insertions(+), 11 deletions(-) rename .github/workflows/{sync-gitea.yml => sync.yml} (62%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f94f27b..2d6f19d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,7 +76,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Setup Gitea Private Key + - name: Setup Private Key uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} @@ -86,14 +86,27 @@ jobs: applets_version=$(curl -s https://api.github.com/repos/jumpserver/applets/releases/latest | grep "tag_name" | awk '{print $2}' | sed 's/"//g' | sed 's/,//g') wget -qO opt/download/applets/pip_packages.zip https://github.com/jumpserver/applets/releases/download/${applets_version}/pip_packages.zip - - name: Sync to Gitea Repository + - name: Sync to Repository run: | - ssh -o StrictHostKeyChecking=no git@gitea.com || echo "" + ssh -o StrictHostKeyChecking=no git@github.com || echo "" rm -rf .git opt/player || echo "" - git clone --depth=1 git@gitea.com:jumpserver/web-static.git - mv opt/* web-static/ + git clone --depth=1 git@github.com:jumpserver-dev/web-static.git + \cp -rf opt/* web-static/ cd web-static git add . git commit -m "Release Version ${{ steps.get-version.outputs.version }}" git tag -a ${{ steps.get-version.outputs.version }} -m "Release Version ${{ steps.get-version.outputs.version }}" git push origin ${{ steps.get-version.outputs.version }} || echo "Tag already exists" + + - name: Setup OSSUTIL + uses: yizhoumo/setup-ossutil@v2 + with: + endpoint: ${{ secrets.OSS_ENDPOINT }} + access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }} + access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }} + ossutil-version: '1.7.14' + + - name: Upload Assets to OSS + run: | + ossutil mkdir oss://jms-pkg/jumpserver/web-static/raw/tag/${{ steps.get-version.outputs.version }}/ || echo "Path already exists" + ossutil cp -r opt/ oss://jms-pkg/jumpserver/web-static/raw/tag/${{ steps.get-version.outputs.version }}/ --update \ No newline at end of file diff --git a/.github/workflows/sync-gitea.yml b/.github/workflows/sync.yml similarity index 62% rename from .github/workflows/sync-gitea.yml rename to .github/workflows/sync.yml index fd84893..e53b644 100644 --- a/.github/workflows/sync-gitea.yml +++ b/.github/workflows/sync.yml @@ -1,4 +1,4 @@ -name: Sync Gitea Repository +name: Sync Repository on: workflow_dispatch: @@ -29,19 +29,32 @@ jobs: git config --global user.name "${GITHUB_ACTOR}" git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" - - name: Setup Gitea Private Key + - name: Setup Private Key uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} - - name: Sync to Gitea Repository + - name: Sync to Repository run: | - ssh -o StrictHostKeyChecking=no git@gitea.com || echo "" + ssh -o StrictHostKeyChecking=no git@github.com || echo "" rm -rf .git opt/player || echo "" - git clone --depth=1 git@gitea.com:jumpserver/web-static.git + git clone --depth=1 git@github.com:jumpserver-dev/web-static.git mv opt/* web-static/ cd web-static git add . git commit -m "Release Version ${{ github.event.inputs.version }}" git tag -a ${{ github.event.inputs.version }} -m "Release Version ${{ github.event.inputs.version }}" - git push origin ${{ github.event.inputs.version }} --force \ No newline at end of file + git push origin ${{ github.event.inputs.version }} --force + + - name: Setup OSSUTIL + uses: yizhoumo/setup-ossutil@v2 + with: + endpoint: ${{ secrets.OSS_ENDPOINT }} + access-key-id: ${{ secrets.OSS_ACCESS_KEY_ID }} + access-key-secret: ${{ secrets.OSS_ACCESS_KEY_SECRET }} + ossutil-version: '1.7.14' + + - name: Upload Assets to OSS + run: | + ossutil mkdir oss://jms-pkg/jumpserver/web-static/raw/tag/${{ steps.get-version.outputs.version }}/ || echo "Path already exists" + ossutil cp -r opt/ oss://jms-pkg/jumpserver/web-static/raw/tag/${{ steps.get-version.outputs.version }}/ --update \ No newline at end of file