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'
|
- 'main'
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
pull_request:
|
|
||||||
|
workflow_run:
|
||||||
|
workflows: [Run Tests on PR]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
|
@ -26,6 +31,10 @@ env:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-container:
|
build-container:
|
||||||
|
if: >
|
||||||
|
github.event_name == 'push' ||
|
||||||
|
( github.event.workflow_run.event == 'pull_request' &&
|
||||||
|
github.event.workflow_run.conclusion == 'success' )
|
||||||
name: Build Container Image
|
name: Build Container Image
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
|
|
@ -39,9 +48,8 @@ jobs:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
fetch-tags: 'true'
|
fetch-tags: 'true'
|
||||||
|
|
||||||
- name: Docker meta for GHCR
|
- name: Docker meta
|
||||||
if: github.event_name != 'pull_request'
|
id: meta
|
||||||
id: meta_ghcr
|
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
images: |
|
images: |
|
||||||
|
|
@ -52,29 +60,15 @@ jobs:
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
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
|
- name: Buildah Build
|
||||||
id: build-image
|
id: build-image
|
||||||
uses: redhat-actions/buildah-build@v2
|
uses: redhat-actions/buildah-build@v2
|
||||||
with:
|
with:
|
||||||
containerfiles: Containerfile
|
containerfiles: Containerfile
|
||||||
tags: ${{ steps.meta_ghcr.outputs.tags || steps.meta_docker.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta_ghcr.outputs.labels || steps.meta_docker.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
- name: Push image to GHCR
|
- name: Push image
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
uses: redhat-actions/push-to-registry@v2
|
uses: redhat-actions/push-to-registry@v2
|
||||||
with:
|
with:
|
||||||
image: ${{ steps.build-image.outputs.image }}
|
image: ${{ steps.build-image.outputs.image }}
|
||||||
|
|
@ -82,15 +76,6 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ github.token }}
|
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:
|
build-and-push-iso:
|
||||||
name: Build ISO
|
name: Build ISO
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue