name: Release on: push: branches: ['main'] tags: ['v*'] workflow_dispatch: inputs: tag: description: 'Docker image tag (e.g. feature-vaapi)' required: false type: string pr: description: 'Pull request number (e.g. 449)' required: false type: string jobs: build-and-push: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout repository id: checkout uses: actions/checkout@v4 with: ref: ${{ inputs.pr && format('refs/pull/{0}/head', inputs.pr) || github.ref }} # Set up Docker Buildx - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 # Log in to Docker Hub - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: shumaione password: ${{ secrets.DOCKERHUB_TOKEN }} # Log in to Aliyun ACR - name: Log in to Aliyun ACR uses: docker/login-action@v3 with: registry: crpi-000nkafzu6xvpwsc.cn-hongkong.personal.cr.aliyuncs.com username: njjyl723 password: ${{ secrets.ALI_ACR_TOKEN }} # Extract metadata (tags, labels) for Docker - name: Extract metadata (tags, labels) for Docker id: meta uses: docker/metadata-action@v5 with: images: | shumaione/shumai crpi-000nkafzu6xvpwsc.cn-hongkong.personal.cr.aliyuncs.com/shumai-one/shumai tags: | type=semver,pattern={{version}} type=ref,event=branch,enable=${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && !inputs.pr && !inputs.tag) }} type=raw,value=pr-${{ inputs.pr }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.pr != '' && inputs.tag == '' }} type=raw,value=${{ inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' && inputs.tag != '' }} labels: | org.opencontainers.image.revision=${{ steps.checkout.outputs.commit }} # Build and push Docker image - name: Build and push Docker image uses: docker/build-push-action@v7 with: platforms: linux/amd64,linux/arm64 context: . push: true provenance: false tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}