[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
on: pull_request
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
jobs:
@ -30,15 +32,9 @@ jobs:
docker-build:
runs-on: ubuntu-latest
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:
- name: Create Tag
id: create-tag
run: |
var="${{ github.head_ref }}"
echo "docker-tag=${var:7}" >> $GITHUB_OUTPUT
- name: Check Out Repo
uses: actions/checkout@v4
with:
@ -66,10 +62,10 @@ jobs:
context: ./
file: ./Dockerfile
build-args: |
"BRANCH_NAME=${{ steps.create-tag.outputs.docker-tag }}"
"BRANCH_NAME=${{ github.head_ref }}"
platforms: linux/amd64,linux/arm64
push: true
tags: kometateam/kometa:${{ steps.create-tag.outputs.docker-tag }}
tags: kometateam/kometa:${{ github.head_ref }}
cache-from: type=gha
cache-to: type=gha,mode=max
@ -78,7 +74,7 @@ jobs:
if: success()
with:
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 }}
color: ${{ vars.COLOR_SUCCESS }}
username: ${{ vars.BOT_NAME }}
@ -92,7 +88,7 @@ jobs:
with:
webhook_id_token: ${{ secrets.BUILD_WEBHOOK }}
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 }}
color: ${{ vars.COLOR_FAILURE }}
username: ${{ vars.BOT_NAME }}

View file

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