cd: fix(spider) closes #8505 closes #8504 closes #8502 closes #8501 closes #8500 closes #8499 closes #8498 #3428
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: check if new pkgs | |
id: check-new-files | |
run: | | |
NEW_FILES=$(git diff --name-status HEAD $(git merge-base HEAD origin/main) | grep '^A\s*projects/.+?/package\.yml$' | wc -l) | |
if [ "$NEW_FILES" -gt 0 ]; then | |
echo "New files were added in this push." | |
echo "::set-output name=new_files::true" | |
fi | |
- name: make payload | |
run: | | |
RV="" | |
for x in ${{ needs.ingest.outputs.projects }}; do | |
RV="${RV:+$RV,} {\"title\": \"$x\", \"url\": \"https://pkgx.dev/pkgs/$x/\"}" | |
done | |
echo "{\"embeds\": [$RV], \"content\": \"new pkgs\"}" >> payload.json | |
- uses: tsickert/[email protected] | |
if: steps.check-new-files.outputs.new_files == 'true' | |
with: | |
webhook-url: ${{ secrets.DISCORD_WEBHOOK }} | |
raw-data: ./payload.json |