docs: DOC-1616: Whitelabels #3316
This file contains 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
# This workflow compresses images in a pull request using the Calibre image optimizer. | |
# The workflow is triggered when a pull request is opened or updated and the PR contains images in the formats .jpg, .jpeg, .png, or .webp. | |
# Due to the workflow requiring commmit permissions, the workflow auhtenticates using the GitHub application created for the docs and education team. | |
# The credentials are stored in the Vault and retrieved using the hashicorp/vault-action action. | |
# Image Optimizer docs: https://github.com/calibreapp/image-actions | |
name: image_optimizer | |
on: | |
pull_request: | |
paths: | |
- "**.jpg" | |
- "**.jpeg" | |
- "**.png" | |
- "**.webp" | |
concurrency: | |
group: image-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
run-ci: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
if: ${{ !github.event.pull_request.draft }} | |
steps: | |
# If the condition above is not met, aka, the PR is not in draft status, then this step is skipped. | |
# Because this step is part of the critical path, omission of this step will result in remaining CI steps not gettinge executed. | |
# As of 8/8/2022 there is now way to enforce this beahvior in GitHub Actions CI. | |
- run: exit 0 | |
image-optimizer: | |
name: Image Optimization | |
needs: [run-ci] | |
runs-on: | |
group: 'Doc Runners' | |
labels: docbot | |
if: ${{ !github.event.pull_request.draft }} | |
steps: | |
- name: Retrieve Credentials | |
id: import-secrets | |
uses: hashicorp/[email protected] | |
with: | |
url: https://vault.prism.spectrocloud.com | |
method: approle | |
roleId: ${{ secrets.VAULT_ROLE_ID }} | |
secretId: ${{ secrets.VAULT_SECRET_ID }} | |
secrets: /providers/github/organizations/spectrocloud/token?org_name=spectrocloud token | VAULT_GITHUB_TOKEN | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Compress Images | |
uses: calibreapp/image-actions@main | |
with: | |
githubToken: ${{ steps.import-secrets.outputs.VAULT_GITHUB_TOKEN }} | |
ignorePaths: "node_modules/**,build" |