Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #43 from jumpserver/dev
Browse files Browse the repository at this point in the history
perf: 优化 actions 脚本
  • Loading branch information
wojiushixiaobai authored Apr 29, 2024
2 parents 3703291 + d51356a commit 49b450d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 44 deletions.
36 changes: 11 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ jobs:
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Get pip_package.zip
run: |
rm -rf opt/player || echo ""
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: Create Tag
run: |
Expand All @@ -73,40 +79,20 @@ jobs:
- name: Create Release
run: |
gh release create ${{ steps.get-version.outputs.version }} --notes "Release ${{ steps.get-version.outputs.version }}" || echo "Release already exists"
gh release upload ${{ steps.get-version.outputs.version }} opt/download/applets/* --clobber
gh release upload ${{ steps.get-version.outputs.version }} opt/download/public/* --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Private Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Get pip_package.zip
run: |
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 Repository
run: |
ssh -o StrictHostKeyChecking=no [email protected] || echo ""
rm -rf .git opt/player || echo ""
git clone --depth=1 [email protected]: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'
ossutil-version: 'latest'

- 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
ossutil mkdir oss://jms-pkg/jumpserver/web-static/releases/download/${{ steps.get-version.outputs.version }}/ || echo "Path already exists"
ossutil cp -r opt/ oss://jms-pkg/jumpserver/web-static/releases/download/${{ steps.get-version.outputs.version }}/ --update
38 changes: 19 additions & 19 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,32 @@ jobs:
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Setup Private Key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Sync to Repository
- name: Create Tag
run: |
ssh -o StrictHostKeyChecking=no [email protected] || echo ""
rm -rf .git opt/player || echo ""
git clone --depth=1 [email protected]: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
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a ${{ steps.get-version.outputs.version }} -m "Release Version ${{ steps.get-version.outputs.version }}" || echo "Tag already exists"
git push origin ${{ steps.get-version.outputs.version }} || echo "Tag already exists"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
run: |
gh release create ${{ steps.get-version.outputs.version }} --notes "Release ${{ steps.get-version.outputs.version }}" || echo "Release already exists"
gh release upload ${{ steps.get-version.outputs.version }} opt/download/applets/* --clobber
gh release upload ${{ steps.get-version.outputs.version }} opt/download/public/* --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- 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'
ossutil-version: 'latest'

- 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
ossutil mkdir oss://jms-pkg/jumpserver/web-static/releases/download/${{ steps.get-version.outputs.version }}/ || echo "Path already exists"
ossutil cp -r opt/ oss://jms-pkg/jumpserver/web-static/releases/download/${{ steps.get-version.outputs.version }}/ --update

0 comments on commit 49b450d

Please sign in to comment.