generated from coopnorge/github-workflows-template
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (110 loc) · 4.25 KB
/
techdocs.yaml
File metadata and controls
110 lines (110 loc) · 4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
on:
workflow_call:
inputs:
docs_dir:
type: string
required: false
default: docs/
docker-compose-service:
type: string
required: false
default: techdocs
fetch-contributors:
type: boolean
required: false
default: false
# The bucket name for TechDocs storage.
techdocs_bucket:
type: string
default: coop-techdocs-backstage-production-44f7
required: false
workload_identity_provider:
type: string
default: projects/1063410054216/locations/global/workloadIdentityPools/techdocs-pool/providers/techdocs-provider
required: false
workload_identity_service_account:
type: string
default: techdocs-publisher@backstage-production-44f7.iam.gserviceaccount.com
required: false
secrets: {}
concurrency:
group: techdocs-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
setup:
runs-on: ubuntu-24.04
permissions:
contents: read
pull-requests: read
outputs:
changed-markdown-files: ${{ steps.paths-filter.outputs.markdown_files }}
changed-markdown: ${{ steps.paths-filter.outputs.markdown }}
build: ${{ steps.paths-filter.outputs.build }}
publish: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4
id: paths-filter
with:
base: main
list-files: shell
filters: |
build:
- catalog-info.yaml
- mkdocs.yml
- mkdocs.yaml
- docker-compose.yaml
- docker-compose.yml
- devtools/techdocs.yaml
- docker-compose/techdocs.yaml
- devtools/Dockerfile
- docker-compose/Dockerfile
- devtools/techdocs.Dockerfile
- docker-compose/techdocs.Dockerfile
- "${{ inputs.docs_dir }}**/*.JPG"
- "${{ inputs.docs_dir }}**/*.jpg"
- "${{ inputs.docs_dir }}**/*.md"
- "${{ inputs.docs_dir }}**/*.png"
- "${{ inputs.docs_dir }}**/*.svg"
- "${{ inputs.docs_dir }}**/.pages"
- "${{ inputs.docs_dir }}**/*.tf"
- "${{ inputs.docs_dir }}**/*.go"
- "${{ inputs.docs_dir }}**/*.py"
- "${{ inputs.docs_dir }}**/*.yaml"
- "${{ inputs.docs_dir }}**/Dockerfile"
- "${{ inputs.docs_dir }}**/*.Dockerfile"
- .vale/**
markdown:
- added|modified: "${{ inputs.docs_dir }}**/*.md"
techdocs:
needs: ["setup"]
if: ${{ needs.setup.outputs.build == 'true' }}
permissions:
contents: read
id-token: write
packages: read
runs-on: ubuntu-24.04
env:
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Validate
if: ${{ needs.setup.outputs.changed-markdown }}
run: 'docker compose run --rm ${{ inputs.docker-compose-service }} validate MARKDOWN_FILES="${{ needs.setup.outputs.changed-markdown-files }}"'
- name: Build site
run: 'docker compose run --rm ${{ inputs.docker-compose-service }} build REPO_NAME="${{ github.repository }}" REPO_URL="${{ github.event.repository.html_url }}" EDIT_URI="edit/${{ github.event.repository.default_branch }}/${{ inputs.docs_dir }}" FETCH_CONTRIBUTORS=${{ inputs.fetch-contributors }} GITHUB_TOKEN=${GITHUB_TOKEN}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: auth
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
if: ${{ needs.setup.outputs.publish == 'true' }}
with:
workload_identity_provider: ${{ inputs.workload_identity_provider }}
service_account: ${{ inputs.workload_identity_service_account }}
export_environment_variables: true
create_credentials_file: true
- name: Publish site
if: ${{ needs.setup.outputs.publish == 'true' }}
run: 'docker compose run --rm ${{ inputs.docker-compose-service }} publish TECHDOCS_BUCKET="${{ inputs.techdocs_bucket }}"'