2022-10-31 21:00:24 +03:00
|
|
|
name: cd
|
2023-12-13 18:30:07 +03:00
|
|
|
run-name: "cd: ${{ github.event.head_commit.message }}"
|
2023-03-14 23:41:37 +03:00
|
|
|
|
2022-10-31 21:00:24 +03:00
|
|
|
on:
|
|
|
|
push:
|
2023-12-13 13:42:25 +03:00
|
|
|
branches: main
|
2024-02-10 17:17:47 +03:00
|
|
|
paths:
|
|
|
|
- projects/**/*
|
|
|
|
- .github/workflows/cd.yml
|
2023-12-13 13:42:25 +03:00
|
|
|
|
2022-10-31 21:00:24 +03:00
|
|
|
jobs:
|
2023-12-13 19:47:32 +03:00
|
|
|
ingest:
|
2022-10-31 21:00:24 +03:00
|
|
|
runs-on: ubuntu-latest
|
2023-01-06 03:19:09 +03:00
|
|
|
outputs:
|
2023-12-13 13:42:25 +03:00
|
|
|
projects: ${{ steps.diff.outputs.diff }}
|
2022-10-31 21:00:24 +03:00
|
|
|
steps:
|
2023-09-30 19:15:42 +03:00
|
|
|
- uses: actions/checkout@v4
|
2023-01-06 02:32:56 +03:00
|
|
|
- uses: technote-space/get-diff-action@v6
|
2023-02-13 17:28:03 +03:00
|
|
|
id: get-diff
|
2023-01-06 02:32:56 +03:00
|
|
|
with:
|
|
|
|
PATTERNS: projects/**/package.yml
|
2023-02-13 17:28:03 +03:00
|
|
|
- id: diff
|
|
|
|
run: |
|
2023-03-14 23:41:37 +03:00
|
|
|
for x in ${{ steps.get-diff.outputs.diff }}; do
|
2023-12-15 21:32:55 +03:00
|
|
|
y=$(echo $x | sed 's#projects/\(.*\)/[^/]*#\1#')
|
|
|
|
RESULT="$RESULT ${y//$'\n'/}"
|
2023-03-14 23:41:37 +03:00
|
|
|
done
|
2023-02-13 17:28:03 +03:00
|
|
|
echo "diff=$RESULT" >> $GITHUB_OUTPUT
|
2023-12-13 13:42:25 +03:00
|
|
|
|
2023-12-13 19:47:32 +03:00
|
|
|
pkg:
|
2023-12-13 13:42:25 +03:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
2023-12-13 19:47:32 +03:00
|
|
|
needs: ingest
|
2023-12-13 18:30:07 +03:00
|
|
|
permissions:
|
|
|
|
issues: write
|
2023-12-13 13:42:25 +03:00
|
|
|
uses: ./.github/workflows/new-version.yml
|
|
|
|
with:
|
2023-12-13 19:47:32 +03:00
|
|
|
projects: ${{ needs.ingest.outputs.projects }}
|
2023-12-13 13:42:25 +03:00
|
|
|
secrets: inherit
|
2024-02-18 20:07:28 +03:00
|
|
|
|
|
|
|
notify:
|
|
|
|
needs: [pkg, ingest]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-02-20 00:23:51 +03:00
|
|
|
- uses: actions/checkout@v4
|
2024-02-19 21:47:33 +03:00
|
|
|
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
|
2024-02-18 20:07:28 +03:00
|
|
|
run: |
|
|
|
|
RV=""
|
|
|
|
for x in ${{ needs.ingest.outputs.projects }}; do
|
2024-02-19 21:47:33 +03:00
|
|
|
RV="${RV:+$RV,} {\"title\": \"$x\", \"url\": \"https://pkgx.dev/pkgs/$x/\"}"
|
2024-02-18 20:07:28 +03:00
|
|
|
done
|
2024-02-19 19:00:56 +03:00
|
|
|
echo "{\"embeds\": [$RV], \"content\": \"new pkgs\"}" >> payload.json
|
2024-02-19 21:47:33 +03:00
|
|
|
|
2024-02-19 19:00:56 +03:00
|
|
|
- uses: tsickert/discord-webhook@v5.4.0
|
2024-02-19 21:47:33 +03:00
|
|
|
if: steps.check-new-files.outputs.new_files == 'true'
|
2024-02-18 20:07:28 +03:00
|
|
|
with:
|
2024-02-19 19:00:56 +03:00
|
|
|
webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
|
|
|
|
raw-data: ./payload.json
|