Skip to content

Commit

Permalink
feat: reduce release build time
Browse files Browse the repository at this point in the history
fixes #196
  • Loading branch information
theseion committed Feb 8, 2024
1 parent 39786ad commit a87805c
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,28 @@ on:
- master

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.generate.outputs.targets }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: List targets
id: generate
uses: docker/bake-action/subaction/list-targets@v4

build:
name: Build ${{ matrix.target }}
runs-on: ubuntu-latest
needs:
- prepare
permissions:
contents: read
packages: write
strategy:
matrix:
repo: ["owasp/modsecurity-crs", "ghcr.io/coreruleset/modsecurity-crs"]
target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -30,25 +44,34 @@ jobs:
driver-opts: image=moby/buildkit:master

- name: Login to DockerHub
if: ${{ startsWith(matrix.repo, 'owasp')}}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: ${{ secrets.dockerhub_user }}
password: ${{ secrets.dockerhub_token }}

- name: Login to GitHub Container Registry
if: ${{ startsWith(matrix.repo, 'ghcr.io')}}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
- name: 'Build and push to Docker Hub: ${{ matrix.target }}'
uses: docker/[email protected]
with:
files: |
./docker-bake.hcl
targets: ${{ matrix.target }}
push: true
env:
REPO: "owasp/modsecurity-crs"

- name: 'Build and push to GitHub: ${{ matrix.target }}'
uses: docker/[email protected]
with:
files: |
./docker-bake.hcl
push: true
targets: ${{ matrix.target }}
env:
REPO: ${{ matrix.repo }}
REPO: "ghcr.io/coreruleset/modsecurity-crs"

0 comments on commit a87805c

Please sign in to comment.