rosa cost explorer (#959) #10
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: Sync Amplify redirects | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - customRules.json | |
| - content/** | |
| - config.toml | |
| - scripts/merge-amplify-redirects.py | |
| - scripts/sync-amplify-redirects.sh | |
| - .github/workflows/sync-amplify-redirects.yml | |
| - themes/rhds/layouts/_default/index.redir | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: read | |
| concurrency: | |
| group: sync-amplify-redirects | |
| cancel-in-progress: false | |
| env: | |
| HUGO_VERSION: "0.157.0" | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Install Hugo | |
| run: | | |
| curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" | |
| mkdir -p "${HOME}/.local/hugo" | |
| tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" | |
| echo "${HOME}/.local/hugo" >> "$GITHUB_PATH" | |
| export PATH="${HOME}/.local/hugo:${PATH}" | |
| hugo version | |
| - name: Generate Hugo alias redirects | |
| run: hugo --gc --minify --theme rhds | |
| - name: Validate GitHub Actions variables | |
| run: | | |
| missing=0 | |
| if [ -z "${{ vars.AWS_AMPLIFY_REDIRECTS_ROLE_ARN }}" ]; then | |
| echo "::error::Set repository variable AWS_AMPLIFY_REDIRECTS_ROLE_ARN (terraform output -raw github_amplify_redirects_role_arn)" | |
| missing=1 | |
| fi | |
| if [ -z "${{ vars.AWS_REGION }}" ]; then | |
| echo "::error::Set repository variable AWS_REGION (same region as Amplify app, e.g. us-east-2)" | |
| missing=1 | |
| fi | |
| if [ -z "${{ vars.AMPLIFY_APP_ID }}" ]; then | |
| echo "::error::Set repository variable AMPLIFY_APP_ID (terraform output -raw amplify_app_id)" | |
| missing=1 | |
| fi | |
| if [ "$missing" -ne 0 ]; then | |
| exit 1 | |
| fi | |
| if [ "${{ github.ref }}" != "refs/heads/main" ]; then | |
| echo "::warning::OIDC trust in documentation-infra allows only refs/heads/main. This workflow must run on main (push or workflow_dispatch from main)." | |
| fi | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v6 | |
| with: | |
| role-to-assume: ${{ vars.AWS_AMPLIFY_REDIRECTS_ROLE_ARN }} | |
| aws-region: ${{ vars.AWS_REGION }} | |
| - name: Merge and sync redirects to Amplify | |
| env: | |
| AWS_APP_ID: ${{ vars.AMPLIFY_APP_ID }} | |
| AWS_REGION: ${{ vars.AWS_REGION }} | |
| run: ./scripts/sync-amplify-redirects.sh |