mirror of
https://github.com/JasonN3/build-container-installer.git
synced 2025-12-25 10:57:55 +01:00
use bot for tests
This commit is contained in:
parent
6d0f1066a5
commit
a18843e281
2 changed files with 37 additions and 30 deletions
22
.github/workflows/bot_run_tests.yml
vendored
Normal file
22
.github/workflows/bot_run_tests.yml
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
name: Run tests on PR
|
||||
on: issue_comment
|
||||
|
||||
jobs:
|
||||
pr_commented:
|
||||
name: Run Tests for PR
|
||||
if: >
|
||||
github.event.issue.pull_request &&
|
||||
contains(github.event.issue.bodyText, '/run tests')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check association
|
||||
run: |
|
||||
allowed=("OWNER" "COLLABORATOR")
|
||||
value="\<${{ github.event.issue.author_association }}\>"
|
||||
|
||||
if [[ ${array[@]} =~ $value ]]
|
||||
then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
45
.github/workflows/build-and-test.yml
vendored
45
.github/workflows/build-and-test.yml
vendored
|
|
@ -6,7 +6,12 @@ on:
|
|||
- 'main'
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
|
||||
workflow_run:
|
||||
workflows: [Run Tests on PR]
|
||||
types:
|
||||
- completed
|
||||
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
|
|
@ -26,6 +31,10 @@ env:
|
|||
|
||||
jobs:
|
||||
build-container:
|
||||
if: >
|
||||
github.event_name == 'push' ||
|
||||
( github.event.workflow_run.event == 'pull_request' &&
|
||||
github.event.workflow_run.conclusion == 'success' )
|
||||
name: Build Container Image
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
|
|
@ -39,9 +48,8 @@ jobs:
|
|||
fetch-depth: 0
|
||||
fetch-tags: 'true'
|
||||
|
||||
- name: Docker meta for GHCR
|
||||
if: github.event_name != 'pull_request'
|
||||
id: meta_ghcr
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
|
|
@ -52,29 +60,15 @@ jobs:
|
|||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
|
||||
- name: Docker meta for Docker Hub
|
||||
if: github.event_name == 'pull_request'
|
||||
id: meta_docker
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: |
|
||||
docker.io/${{ github.repository }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
|
||||
- name: Buildah Build
|
||||
id: build-image
|
||||
uses: redhat-actions/buildah-build@v2
|
||||
with:
|
||||
containerfiles: Containerfile
|
||||
tags: ${{ steps.meta_ghcr.outputs.tags || steps.meta_docker.outputs.tags }}
|
||||
labels: ${{ steps.meta_ghcr.outputs.labels || steps.meta_docker.outputs.labels }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
- name: Push image to GHCR
|
||||
if: github.event_name != 'pull_request'
|
||||
- name: Push image
|
||||
uses: redhat-actions/push-to-registry@v2
|
||||
with:
|
||||
image: ${{ steps.build-image.outputs.image }}
|
||||
|
|
@ -82,15 +76,6 @@ jobs:
|
|||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
|
||||
- name: Push image to Docker
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: redhat-actions/push-to-registry@v2
|
||||
with:
|
||||
image: ${{ steps.build-image.outputs.image }}
|
||||
tags: ${{ steps.build-image.outputs.tags }}
|
||||
username: ${{ secrets.DOCKER_LOGIN }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
build-and-push-iso:
|
||||
name: Build ISO
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue