pantry/.github/workflows/cd.yml

61 lines
1.6 KiB
YAML
Raw Normal View History

name: cd
run-name: "cd: ${{ github.event.head_commit.message }}"
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
jobs:
2023-12-13 19:47:32 +03:00
ingest:
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 }}
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: |
for x in ${{ steps.get-diff.outputs.diff }}; do
y=$(echo $x | sed 's#projects/\(.*\)/[^/]*#\1#')
RESULT="$RESULT ${y//$'\n'/}"
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
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
tarball:
runs-on: ubuntu-latest
steps:
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- uses: actions/checkout@v4
2024-02-10 19:51:15 +03:00
with:
path: co
- run: find co -type f -not -name package.yml -delete -o -type l -delete
- run: tar -C co -czf pantry.tgz .
- run: aws s3 cp
./pantry.tgz
s3://${{ secrets.AWS_S3_BUCKET }}/pantry.tgz
- run: aws cloudfront create-invalidation
--distribution-id ${{ secrets.AWS_CF_DISTRIBUTION_ID }}
--paths /pantry.tgz