|
| 1 | +name: Changelog upload |
| 2 | +description: > |
| 3 | + Uploads changelog entries to the elastic-docs-v3-changelog-bundles S3 bucket |
| 4 | + using docs-builder's incremental upload. Intended to run on push to the default |
| 5 | + branch (main/master). Only files whose content has changed are transferred. |
| 6 | +
|
| 7 | +inputs: |
| 8 | + config: |
| 9 | + description: 'Path to changelog.yml configuration file (repo-relative, no ".." or absolute paths)' |
| 10 | + default: 'docs/changelog.yml' |
| 11 | + github-token: |
| 12 | + description: 'GitHub token (used by docs-builder setup). Use the default GITHUB_TOKEN; do not substitute a broader PAT.' |
| 13 | + default: '${{ github.token }}' |
| 14 | + aws-account-id: |
| 15 | + description: 'The AWS account ID. Only override if OIDC trust and IAM roles have been provisioned for the target account.' |
| 16 | + default: '197730964718' |
| 17 | + |
| 18 | +runs: |
| 19 | + using: composite |
| 20 | + steps: |
| 21 | + - name: Verify push to default branch |
| 22 | + shell: bash |
| 23 | + env: |
| 24 | + REF: ${{ github.ref }} |
| 25 | + run: | |
| 26 | + if [[ "$REF" != "refs/heads/main" && "$REF" != "refs/heads/master" ]]; then |
| 27 | + echo "::error::changelog upload must run on a push to main or master (got $REF)" |
| 28 | + exit 1 |
| 29 | + fi |
| 30 | +
|
| 31 | + - name: Validate config path |
| 32 | + shell: bash |
| 33 | + env: |
| 34 | + CONFIG: ${{ inputs.config }} |
| 35 | + run: | |
| 36 | + if [[ "$CONFIG" == /* ]]; then |
| 37 | + echo "::error::config path must be relative, not absolute: ${CONFIG}" |
| 38 | + exit 1 |
| 39 | + fi |
| 40 | + if [[ "$CONFIG" == *..* ]]; then |
| 41 | + echo "::error::config path must not contain '..': ${CONFIG}" |
| 42 | + exit 1 |
| 43 | + fi |
| 44 | + if [[ "$CONFIG" == *$'\n'* || "$CONFIG" == *$'\r'* ]]; then |
| 45 | + echo "::error::config path must not contain newlines" |
| 46 | + exit 1 |
| 47 | + fi |
| 48 | +
|
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v6 |
| 51 | + with: |
| 52 | + ref: ${{ github.sha }} |
| 53 | + persist-credentials: false |
| 54 | + |
| 55 | + - name: Setup docs-builder |
| 56 | + uses: elastic/docs-actions/docs-builder/setup@v1 |
| 57 | + with: |
| 58 | + version: edge |
| 59 | + github-token: ${{ inputs.github-token }} |
| 60 | + |
| 61 | + - name: Authenticate with AWS |
| 62 | + uses: elastic/docs-actions/aws/auth@v1 |
| 63 | + with: |
| 64 | + aws_account_id: ${{ inputs.aws-account-id }} |
| 65 | + aws_role_name_prefix: elastic-docs-v3-changelog- |
| 66 | + |
| 67 | + - name: Upload changelogs |
| 68 | + shell: bash |
| 69 | + env: |
| 70 | + CONFIG: ${{ inputs.config }} |
| 71 | + run: | |
| 72 | + docs-builder changelog upload \ |
| 73 | + --artifact-type changelog \ |
| 74 | + --target s3 \ |
| 75 | + --s3-bucket-name elastic-docs-v3-changelog-bundles \ |
| 76 | + --config "$CONFIG" |
0 commit comments