Skip to content

Merge pull request #1892 from gofiber/dependabot/go_modules/v3/coraza… #1750

Merge pull request #1892 from gofiber/dependabot/go_modules/v3/coraza…

Merge pull request #1892 from gofiber/dependabot/go_modules/v3/coraza… #1750

name: Release Drafter (v3 packages)
on:
push:
branches:
- master
- main
workflow_dispatch:
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
packages: ${{ github.event_name == 'workflow_dispatch' && steps.filter-setup.outputs.packages || steps.map-packages.outputs.packages || '[]' }}
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Generate filters
id: filter-setup
shell: bash
run: |
shopt -s nullglob
packages=(v3/*/)
package_names=()
if (( ${#packages[@]} == 0 )); then
echo "filters={}" >> "$GITHUB_OUTPUT"
echo "packages=[]" >> "$GITHUB_OUTPUT"
exit 0
fi
{
echo "filters<<EOF"
for pkg in "${packages[@]}"; do
name=${pkg#v3/}
name=${name%/}
path=${pkg%/}
printf "'%s': '%s/**'\n" "$name" "$path"
package_names+=("$path")
done
echo "EOF"
} >> "$GITHUB_OUTPUT"
if (( ${#package_names[@]} > 0 )); then
printf -v joined '"%s",' "${package_names[@]}"
joined=${joined%,}
echo "packages=[${joined}]" >> "$GITHUB_OUTPUT"
else
echo "packages=[]" >> "$GITHUB_OUTPUT"
fi
- name: Filter changes
id: filter
uses: dorny/paths-filter@v4
if: github.event_name != 'workflow_dispatch'
with:
filters: ${{ steps.filter-setup.outputs.filters }}
- name: Map package paths
id: map-packages
if: github.event_name != 'workflow_dispatch'
env:
FILTER_PACKAGES: ${{ steps.filter.outputs.changes || '[]' }}
run: |
python3 - <<'PY' >> "$GITHUB_OUTPUT"
import json
import os
packages = json.loads(os.environ["FILTER_PACKAGES"])
paths = [f"v3/{name}" for name in packages]
print(f"packages={json.dumps(paths)}")
PY
release-drafter:
needs: changes
runs-on: ubuntu-latest
timeout-minutes: 30
if: needs.changes.outputs.packages != '[]'
permissions:
contents: write
pull-requests: read
strategy:
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages || '[]') }}
steps:
- name: Checkout shared config
uses: actions/checkout@v6
with:
repository: gofiber/.github
sparse-checkout: .github/release-drafter-module.yml
sparse-checkout-cone-mode: false
- name: Generate config from shared template
run: |
sed "s|{{MODULE}}|${{ matrix.package }}|g" \
.github/release-drafter-module.yml > .github/release-drafter-parsed.yml
- name: Run release drafter
uses: release-drafter/release-drafter@v7
with:
config-name: file:release-drafter-parsed.yml