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

Merge pull request #45 from jumpserver/dev #37

Merge pull request #45 from jumpserver/dev

Merge pull request #45 from jumpserver/dev #37

Workflow file for this run

on:
push:
branches:
- master
name: Checkout and Create Release Version
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get version
id: get-version
run: |
version=$(cat VERSION)
echo "version=${version}" >> $GITHUB_OUTPUT
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to FIT2CLOUD Container Registry
uses: docker/login-action@v3
with:
registry: registry.fit2cloud.com
username: ${{ secrets.FIT2CLOUD_USERNAME }}
password: ${{ secrets.FIT2CLOUD_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare files
run: |
bash prepare.sh
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le,linux/s390x,linux/mips64le
push: true
tags: |
jumpserver/web-static:${{ steps.get-version.outputs.version }}
ghcr.io/jumpserver/web-static:${{ steps.get-version.outputs.version }}
registry.fit2cloud.com/jumpserver/web-static:${{ steps.get-version.outputs.version }}
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: |
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: 'latest'
- name: Upload Assets to OSS
run: |
ossutil mkdir oss://jms-pkg/jumpserver/web-static/releases/download/${{ steps.get-version.outputs.version }}/ || echo "Path already exists"
ossutil cp -r opt/download/applets/ oss://jms-pkg/jumpserver/web-static/releases/download/${{ steps.get-version.outputs.version }}/ --update
ossutil cp -r opt/download/public/ oss://jms-pkg/jumpserver/web-static/releases/download/${{ steps.get-version.outputs.version }}/ --update