From 08d1220bc1b0e696d678786e63c99c8b23ece7d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=B0=8F=E7=99=BD?= <296015668@qq.com> Date: Thu, 11 Apr 2024 15:28:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=90=8C=E6=AD=A5=20gitea?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/jms-build-test.yml | 15 ++++++---- .github/workflows/release.yml | 19 +++++++++++- .github/workflows/sync-gitea.yml | 45 ++++++++++++++++++++++++++++ VERSION | 2 +- 4 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/sync-gitea.yml diff --git a/.github/workflows/jms-build-test.yml b/.github/workflows/jms-build-test.yml index b32fdcc..edc80e8 100644 --- a/.github/workflows/jms-build-test.yml +++ b/.github/workflows/jms-build-test.yml @@ -11,15 +11,20 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: docker/setup-qemu-action@v2 - - uses: docker/setup-buildx-action@v2 - - uses: docker/build-push-action@v3 + - uses: docker/setup-qemu-action@v3 + - uses: docker/setup-buildx-action@v3 + + - name: Prepare files + run: | + bash prepare.sh + + - name: Build and push + uses: docker/build-push-action@v3 with: context: . push: false tags: jumpserver/web-static:test - build-args: | - APT_MIRROR=http://deb.debian.org file: Dockerfile + outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true cache-from: type=gha cache-to: type=gha,mode=max diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index abfec51..6794194 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,4 +69,21 @@ jobs: run: | gh release create ${{ steps.get-version.outputs.version }} --notes "Release ${{ steps.get-version.outputs.version }}" || echo "Release already exists" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Gitea Private Key + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Sync to Gitea Repository + run: | + ssh -o StrictHostKeyChecking=no git@gitea.com || echo "" + rm -rf .git || echo "" + git clone --depth=1 git@gitea.com:jumpserver/web-static.git + mv 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" diff --git a/.github/workflows/sync-gitea.yml b/.github/workflows/sync-gitea.yml new file mode 100644 index 0000000..780f6ed --- /dev/null +++ b/.github/workflows/sync-gitea.yml @@ -0,0 +1,45 @@ +name: Sync Gitea Repository + +on: + workflow_dispatch: + inputs: + version: + description: 'Build Version' + required: true + default: 'v1.1.1' + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Prepare files + run: | + bash prepare.sh + + - 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 Gitea Private Key + uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Sync to Gitea Repository + run: | + ssh -o StrictHostKeyChecking=no git@gitea.com || echo "" + rm -rf .git || echo "" + git clone --depth=1 git@gitea.com:jumpserver/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 diff --git a/VERSION b/VERSION index 992977a..9cb4db9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.1.0 \ No newline at end of file +v1.1.1 \ No newline at end of file