[35] use labels to build Docker PRs (#2088)

This commit is contained in:
meisnate12 2024-05-31 01:05:51 -04:00 committed by GitHub Action
parent 0f0c47d9be
commit 2c980e99b1
2 changed files with 9 additions and 13 deletions

View file

@ -1,6 +1,8 @@
name: Validate Pull Request name: Validate Pull Request
on: pull_request on:
pull_request:
types: [opened, synchronize, reopened, labeled]
jobs: jobs:
@ -30,15 +32,9 @@ jobs:
docker-build: docker-build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [ validate-pull ] needs: [ validate-pull ]
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && github.base_ref == 'nightly' && startswith(github.head_ref, 'docker-') if: contains(github.event.pull_request.labels.*.name, 'docker')
steps: steps:
- name: Create Tag
id: create-tag
run: |
var="${{ github.head_ref }}"
echo "docker-tag=${var:7}" >> $GITHUB_OUTPUT
- name: Check Out Repo - name: Check Out Repo
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@ -66,10 +62,10 @@ jobs:
context: ./ context: ./
file: ./Dockerfile file: ./Dockerfile
build-args: | build-args: |
"BRANCH_NAME=${{ steps.create-tag.outputs.docker-tag }}" "BRANCH_NAME=${{ github.head_ref }}"
platforms: linux/amd64,linux/arm64 platforms: linux/amd64,linux/arm64
push: true push: true
tags: kometateam/kometa:${{ steps.create-tag.outputs.docker-tag }} tags: kometateam/kometa:${{ github.head_ref }}
cache-from: type=gha cache-from: type=gha
cache-to: type=gha,mode=max cache-to: type=gha,mode=max
@ -78,7 +74,7 @@ jobs:
if: success() if: success()
with: with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }} webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
title: "${{ vars.REPO_NAME }} ${{ steps.create-tag.outputs.docker-tag }}: ${{ vars.TEXT_SUCCESS }}" title: "${{ vars.REPO_NAME }} ${{ github.head_ref }}: ${{ vars.TEXT_SUCCESS }}"
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }} url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: ${{ vars.COLOR_SUCCESS }} color: ${{ vars.COLOR_SUCCESS }}
username: ${{ vars.BOT_NAME }} username: ${{ vars.BOT_NAME }}
@ -92,7 +88,7 @@ jobs:
with: with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }} webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
message: ${{ vars.BUILD_FAILURE_ROLE }} message: ${{ vars.BUILD_FAILURE_ROLE }}
title: "${{ vars.REPO_NAME }} ${{ steps.create-tag.outputs.docker-tag }}: ${{ vars.TEXT_FAILURE }}" title: "${{ vars.REPO_NAME }} ${{ github.head_ref }}: ${{ vars.TEXT_FAILURE }}"
url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }} url: https://github.com/Kometa-Team/${{ vars.REPO_NAME }}/actions/runs/${{ github.run_id }}
color: ${{ vars.COLOR_FAILURE }} color: ${{ vars.COLOR_FAILURE }}
username: ${{ vars.BOT_NAME }} username: ${{ vars.BOT_NAME }}

View file

@ -1 +1 @@
2.0.1-build34 2.0.1-build35