59 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
name: Dashboard image
 | 
						|
 | 
						|
on:
 | 
						|
  workflow_run:
 | 
						|
    workflows: ["Run Tests"]
 | 
						|
    branches: [master]
 | 
						|
    types:
 | 
						|
      - completed
 | 
						|
  workflow_dispatch:
 | 
						|
 | 
						|
jobs:
 | 
						|
  on-success:
 | 
						|
    if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
 | 
						|
    runs-on: ubuntu-latest
 | 
						|
    steps:
 | 
						|
      - uses: actions/checkout@master
 | 
						|
 | 
						|
      - name: Log in to the GHCR
 | 
						|
        uses: docker/login-action@master
 | 
						|
        with:
 | 
						|
          registry: ghcr.io
 | 
						|
          username: ${{ github.repository_owner }}
 | 
						|
          password: ${{ secrets.GITHUB_TOKEN }}
 | 
						|
 | 
						|
      - name: Log in to the AliyunCS
 | 
						|
        uses: docker/login-action@master
 | 
						|
        with:
 | 
						|
          registry: registry.cn-shanghai.aliyuncs.com
 | 
						|
          username: ${{ secrets.ALI_USER }}
 | 
						|
          password: ${{ secrets.ALI_PAT }}
 | 
						|
 | 
						|
      - name: Set up QEMU
 | 
						|
        uses: docker/setup-qemu-action@v1
 | 
						|
 | 
						|
      - name: Set up Docker Buildx
 | 
						|
        uses: docker/setup-buildx-action@v1
 | 
						|
 | 
						|
      - name: Set up image name
 | 
						|
        run: |
 | 
						|
          GHRC_IMAGE_NAME=$(echo "ghcr.io/${{ github.repository_owner }}/nezha-dashboard" | tr '[:upper:]' '[:lower:]')
 | 
						|
          if [ ${{ github.repository_owner }} = "naiba" ]
 | 
						|
            then ALI_IMAGE_NAME=$(echo "registry.cn-shanghai.aliyuncs.com/naibahq/nezha-dashboard")
 | 
						|
            else ALI_IMAGE_NAME=$(echo "registry.cn-shanghai.aliyuncs.com/${{ github.repository_owner }}/nezha-dashboard" | tr '[:upper:]' '[:lower:]')
 | 
						|
          fi
 | 
						|
          echo "::set-output name=GHRC_IMAGE_NAME::$GHRC_IMAGE_NAME"
 | 
						|
          echo "::set-output name=ALI_IMAGE_NAME::$ALI_IMAGE_NAME"
 | 
						|
        id: image-name
 | 
						|
 | 
						|
      - name: Build dasbboard image And Push
 | 
						|
        uses: docker/build-push-action@v2
 | 
						|
        with:
 | 
						|
          context: .
 | 
						|
          file: ./Dockerfile
 | 
						|
          platforms: linux/amd64,linux/arm64,linux/arm,linux/386,linux/s390x
 | 
						|
          push: true
 | 
						|
          tags: |
 | 
						|
            ${{ steps.image-name.outputs.GHRC_IMAGE_NAME }}
 | 
						|
            ${{ steps.image-name.outputs.ALI_IMAGE_NAME }}
 |