Skip to content

contentful_update #1530

contentful_update

contentful_update #1530

name: deploy
on:
repository_dispatch:
types: [contentful_update]
permissions:
id-token: write
contents: write # This is required for actions/checkout
concurrency:
group: contentful_updates
cancel-in-progress: false # This will allow the workflow to run even if another one is already running
jobs:
commit_changes:
runs-on: ubuntu-latest
steps:
- name: Random sleep to avoid race condition that doesn't detect concurrency
run: |
time=$((RANDOM % 7 + RANDOM % 7 + RANDOM % 7))s
echo "Random sleep for $time seconds"
sleep $time
- uses: actions/checkout@master
with:
token: ${{ secrets.CONTENTFUL_GITHUB_TOKEN }}
fetch-depth: 0
- name: Set environment variables
run: |
echo "GITHUB_EVENT_SPACE_ID=${{ github.event.client_payload.spaceID }}" >> $GITHUB_ENV
echo "GITHUB_EVENT_USER_ID=${{ github.event.client_payload.userID }}" >> $GITHUB_ENV
echo "GITHUB_EVENT_ENTITY_ID=${{ github.event.client_payload.entityID }}" >> $GITHUB_ENV
echo "GITHUB_EVENT_CHANGE_TYPE=${{ github.event.client_payload.changeType }}" >> $GITHUB_ENV
- name: Pull latest changes and rebase
run: |
git config user.email "[email protected]"
git config user.name "SPP Machine User"
git pull --rebase origin main
- name: Record CMS changes
env:
CONTENTFUL_TOKEN: ${{ secrets.CONTENTFUL_TOKEN }}
CONTENTFUL_CDA_TOKEN: ${{ secrets.CONTENTFUL_CDA_TOKEN }}
run: |
chmod +x scripts/update_changelog.sh
scripts/update_changelog.sh preprod || exit 1
- name: Import GPG
uses: crazy-max/[email protected]
with:
gpg_private_key: ${{ secrets.SIGNING_KEY }}
- name: Commit and Push Changes
run: |
git config user.email "[email protected]"
git config user.name "SPP Machine User"
git config user.signingkey 79DDAC12EE2E036D
git config commit.gpgsign true
git commit -am "feat: User changes to contentful content model"
git push --force-with-lease origin main