mirror of
https://github.com/ivabus/pantry
synced 2024-11-26 10:25:05 +03:00
60 lines
1.6 KiB
YAML
60 lines
1.6 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
|
|
|
|
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
|
|
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
|