pantry/.github/workflows/cd.yml
2024-02-18 12:27:16 -05:00

58 lines
1.5 KiB
YAML

name: cd
run-name: "cd: ${{ github.event.head_commit.message }}"
on:
push:
branches: main
paths:
- projects/**/*
- .github/workflows/cd.yml
jobs:
ingest:
runs-on: ubuntu-latest
outputs:
projects: ${{ steps.diff.outputs.diff }}
steps:
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
id: get-diff
with:
PATTERNS: projects/**/package.yml
- id: diff
run: |
for x in ${{ steps.get-diff.outputs.diff }}; do
y=$(echo $x | sed 's#projects/\(.*\)/[^/]*#\1#')
RESULT="$RESULT ${y//$'\n'/}"
done
echo "diff=$RESULT" >> $GITHUB_OUTPUT
pkg:
strategy:
fail-fast: false
needs: ingest
permissions:
issues: write
uses: ./.github/workflows/new-version.yml
with:
projects: ${{ needs.ingest.outputs.projects }}
secrets: inherit
notify:
needs: [pkg, ingest]
runs-on: ubuntu-latest
steps:
- name: make embeds
id: make-embeds
run: |
RV=""
for x in ${{ needs.ingest.outputs.projects }}; do
RV="${RV:+$RV,} {\"title\": \"$x\", \"url\": \"https://pkgx.dev/pkgs/$x\"}"
done
echo "json={\"embeds\": [$RV]}" >> $GITHUB_OUTPUT
- uses: Ilshidur/action-discord@0.3.2
env:
DISCORD_EMBEDS: ${{ steps.make-embeds.outputs.json }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: new pkgs