This repository has been archived by the owner on Aug 8, 2024. It is now read-only.
Sync Repository #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Repository | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Build Version' | |
required: true | |
default: 'v1.1.3' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Prepare files | |
run: | | |
bash prepare.sh | |
- 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: Set git config | |
run: | | |
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 | |
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 | |
- 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 |