removed locus markers from syrTitle and added content display field #27
This file contains hidden or 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: Deploy to S3 | |
| on: | |
| push: | |
| branches: | |
| - 'main' # Trigger the workflow on push to the branch | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Check out the repository code | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Fetch the full history for accurate diff comparisons | |
| # Explicitly check out the 'main' branch | |
| - name: Ensure the correct branch is checked out | |
| run: | | |
| git checkout main | |
| git branch --show-current # Verify the checked-out branch | |
| # Step 2: Configure AWS credentials | |
| - name: Configure AWS credentials from AWS account | |
| uses: aws-actions/configure-aws-credentials@v2 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_GADDEL_ROLE }} | |
| aws-region: ${{ secrets.AWS_REGION }} | |
| role-session-name: GitHub-OIDC-frontend | |
| # Step 3: Files to S3 | |
| # # Option 1: Upload only changed files to S3 | |
| # - name: Get list of changed files | |
| # id: changes | |
| # run: | | |
| # git fetch origin main | |
| # git diff --name-only HEAD^ HEAD > changed_files.txt | |
| # cat changed_files.txt | |
| # # This will delete files in S3 not in the repo, except in the data and test and redirects folders | |
| # - name: Sync changed files in S3 | |
| # if: success() | |
| # run: | | |
| # while read file; do | |
| # echo "Attempting to upload $file..." | |
| # if ! aws s3 cp "$file" "s3://srophe-syriaca-front-end/$file" ; then | |
| # echo "File $file not found. Falling back to sync for deletion handling." | |
| # aws s3 sync ./ s3://srophe-syriaca-front-end --delete --exact-timestamps --exclude "deleted-files/*"--exclude "json-data/*" --exclude "testHtml/*" --exclude "person/*" --exclude "place/*" --exclude "keyword/*" --exclude "taxonomy/*" --exclude "redirects/*" --exclude "cbss/*" --exclude "subject/*" --exclude "work/*" | |
| # break # Stop further uploads and rely on sync | |
| # fi | |
| # done < changed_files.txt | |
| # env: | |
| # AWS_REGION: ${{ secrets.AWS_REGION }} | |
| # AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | |
| # - name: Invalidate CloudFront Cache | |
| # run: | | |
| # aws cloudfront create-invalidation \ | |
| # --distribution-id ${{ secrets.GADDEL_CLOUDFRONT_DISTRIBUTION_ID}} \ | |
| # --paths "/*" | |
| # env: | |
| # AWS_REGION: ${{ secrets.AWS_REGION }} | |
| # AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | |
| # Option 2: Full redeployment | |
| - name: Debug | |
| run: aws s3 sync ./ s3://gaddel-britishlibrary-site --delete --exact-timestamps --dryrun | |
| - name: Sync all files to S3 | |
| run: | | |
| aws s3 sync ./ s3://gaddel-britishlibrary-site --delete --exact-timestamps --exclude "persons/*" --exclude ".git/*" --exclude ".github/*" --exclude "tests/*" --exclude "siteGenerator/*" --exclude ".DS_Store" | |
| env: | |
| AWS_REGION: ${{ secrets.AWS_REGION }} | |
| AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} |