Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRs comming from forks do not push images #305

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,20 @@ env:
MAIN_BRANCH_NAME: main

jobs:
dump:
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
build:
name: Build
# for regulars pushes, tags and not forks
if: |
(startsWith(github.ref, 'refs/tags/')) ||
(!startsWith(github.ref, 'refs/tags/') &&
github.event.repository.full_name == github.repository)
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -72,6 +84,11 @@ jobs:
retention-days: 1
merge:
runs-on: ubuntu-latest
# for regulars pushes, tags and not forks
if: |
(startsWith(github.ref, 'refs/tags/')) ||
(!startsWith(github.ref, 'refs/tags/') &&
github.event.repository.full_name == github.repository)
needs:
- build
steps:
Expand Down Expand Up @@ -111,4 +128,24 @@ jobs:
docker buildx imagetools inspect ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/limitador:${{ steps.meta.outputs.version }}
- name: Smoke Test
run: |
docker run --rm -t ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/limitador:${{ steps.meta.outputs.version }} limitador-server --help
docker run --rm -t ${{ env.IMG_REGISTRY_HOST }}/${{ env.IMG_REGISTRY_ORG }}/limitador:${{ steps.meta.outputs.version }} limitador-server --help
build-from-forks:
name: Build on forks
# for forks
if: |
github.event.repository.full_name != github.repository
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: limitador
tags: ${{ github.sha }}
dockerfiles: |
./Dockerfile
- name: Smoke Test
run: |
docker run --rm -t limitador:${{ github.sha }} limitador-server --help
Loading