Skip to content

Commit 5669279

Browse files
author
amandah
committed
initial commit
0 parents  commit 5669279

39 files changed

+39469
-0
lines changed

.env.example

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
REPO_GITHUB_TOKEN=
2+
REPO_OWNER=AdobeDocs
3+
REPO_NAME=dev-site-documentation-template
4+
REPO_BRANCH=main

.github/CONTRIBUTING.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Contributing
2+
3+
Thanks for choosing to contribute!
4+
5+
The following are a set of guidelines to follow when contributing to this project.
6+
7+
## Code Of Conduct
8+
9+
This project adheres to the Adobe [code of conduct](../CODE_OF_CONDUCT.md). By participating,
10+
you are expected to uphold this code. Please report unacceptable behavior to
11+
12+
13+
## Have A Question?
14+
15+
Start by filing an issue. The existing committers on this project work to reach
16+
consensus around project direction and issue solutions within issue threads
17+
(when appropriate).
18+
19+
## Contributor License Agreement
20+
21+
All third-party contributions to this project must be accompanied by a signed contributor
22+
license agreement. This gives Adobe permission to redistribute your contributions
23+
as part of the project. [Sign our CLA](https://opensource.adobe.com/cla.html). You
24+
only need to submit an Adobe CLA one time, so if you have submitted one previously,
25+
you are good to go!
26+
27+
## Code Reviews
28+
29+
All submissions should come in the form of pull requests and need to be reviewed
30+
by project committers. Read [GitHub's pull request documentation](https://help.github.com/articles/about-pull-requests/)
31+
for more information on sending pull requests.
32+
33+
Lastly, please follow the [pull request template](PULL_REQUEST_TEMPLATE.md) when
34+
submitting a pull request!
35+
36+
## From Contributor To Committer
37+
38+
We love contributions from our community! If you'd like to go a step beyond contributor
39+
and become a committer with full write access and a say in the project, you must
40+
be invited to the project. The existing committers employ an internal nomination
41+
process that must reach lazy consensus (silence is approval) before invitations
42+
are issued. If you feel you are qualified and want to get more deeply involved,
43+
feel free to reach out to existing committers to have a conversation about that.
44+
45+
## Security Issues
46+
47+
Security issues shouldn't be reported on this issue tracker. Instead, [file an issue to our security experts](https://helpx.adobe.com/security/alertus.html).

.github/ISSUE_TEMPLATE.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!--- STOP! Before you open an issue please search this repository's issues to see if it has already been reported. This helps reduce duplicate issues from being created. -->
2+
<!--- SECURITY DISCLOSURE: If this is a security disclosure please follow the guidelines in CONTRIBUTING.md. This helps keep folks from accidentally releasing vulnerabilities before the maintainers get a chance to fix the issue. -->
3+
4+
### Expected Behaviour
5+
6+
### Actual Behaviour
7+
8+
### Reproduce Scenario (including but not limited to)
9+
10+
#### Steps to Reproduce
11+
12+
#### Platform and Version
13+
14+
#### Sample Code that illustrates the problem
15+
16+
#### Logs taken while reproducing problem

.github/PULL_REQUEST_TEMPLATE.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!--- Provide a general summary of your changes in the Title above -->
2+
3+
## Description
4+
5+
<!--- Describe your changes in detail -->
6+
7+
## Related Issue
8+
9+
<!--- This project only accepts pull requests related to open issues -->
10+
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
11+
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
12+
<!--- Please link to the issue here: -->
13+
14+
## Motivation and Context
15+
16+
<!--- Why is this change required? What problem does it solve? -->
17+
18+
## How Has This Been Tested?
19+
20+
<!--- Please describe in detail how you tested your changes. -->
21+
<!--- Include details of your testing environment, and the tests you ran to -->
22+
<!--- see how your change affects other areas of the code, etc. -->
23+
24+
## Screenshots (if appropriate):
25+
26+
## Types of changes
27+
28+
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
29+
30+
- [ ] Bug fix (non-breaking change which fixes an issue)
31+
- [ ] New feature (non-breaking change which adds functionality)
32+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
33+
34+
## Checklist:
35+
36+
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
37+
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
38+
39+
- [ ] I have signed the [Adobe Open Source CLA](https://opensource.adobe.com/cla.html).
40+
- [ ] My code follows the code style of this project.
41+
- [ ] My change requires a change to the documentation.
42+
- [ ] I have updated the documentation accordingly.
43+
- [ ] I have read the **CONTRIBUTING** document.
44+
- [ ] I have added tests to cover my changes.
45+
- [ ] All new and existing tests passed.

.github/dependabot.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for npm
4+
- package-ecosystem: "npm"
5+
# Look for `package.json` and `lock` files in the `root` directory
6+
directory: "/"
7+
# Check the npm registry for updates every day (weekdays)
8+
schedule:
9+
interval: "daily"
10+
versioning-strategy: increase
11+
open-pull-requests-limit: 25
12+
labels:
13+
- "dependencies"
14+
ignore:
15+
# Ignore updates to package
16+
- dependency-name: "gatsby"

.github/workflows/deploy.yml

+223
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
name: Deploy
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
env:
6+
description: 'Deploy to (dev|prod|dev prod)'
7+
required: true
8+
default: 'dev'
9+
clean:
10+
description: 'Clean cache (yes|no)'
11+
required: true
12+
default: 'no'
13+
excludeSubfolder:
14+
description: 'Exclude a subfolder from deletion'
15+
required: false
16+
default: ''
17+
jobs:
18+
set-state:
19+
runs-on: ubuntu-latest
20+
outputs:
21+
deploy_prod: ${{ contains(github.event.inputs.env, 'prod') }}
22+
deploy_dev: ${{ contains(github.event.inputs.env, 'dev') }}
23+
clean_cache: ${{ contains(github.event.inputs.clean, 'yes') }}
24+
path_prefix: ${{ steps.extract_path_prefix.outputs.path_prefix }}
25+
branch_short_ref: ${{ steps.extract_branch.outputs.branch }}
26+
exclude_subfolder: ${{ github.event.inputs.excludeSubfolder }}
27+
steps:
28+
- name: Checkout
29+
uses: actions/[email protected] # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
30+
with:
31+
persist-credentials: false
32+
- name: Extract path prefix
33+
uses: actions/github-script@v3
34+
id: extract_path_prefix
35+
with:
36+
script: |
37+
const {pathPrefix} = require(`${process.env.GITHUB_WORKSPACE}/gatsby-config.js`)
38+
if (!pathPrefix) {
39+
core.setFailed('Missing path prefix')
40+
}
41+
else if (pathPrefix === '/') {
42+
core.setFailed('Path prefix "/" is not allowed')
43+
}
44+
else if (!pathPrefix.startsWith('/') || !pathPrefix.endsWith('/')) {
45+
core.setFailed('Path prefix should start and end with "/"')
46+
}
47+
core.setOutput('path_prefix', pathPrefix)
48+
- name: Extract branch name
49+
shell: bash
50+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
51+
id: extract_branch
52+
53+
echo-state:
54+
needs: [set-state]
55+
runs-on: ubuntu-latest
56+
steps:
57+
- run: echo "Deploy to dev - ${{ needs.set-state.outputs.deploy_dev }}"
58+
- run: echo "Deploy to prod - ${{ needs.set-state.outputs.deploy_prod }}"
59+
- run: echo "Clean cache - ${{ needs.set-state.outputs.clean_cache }}"
60+
- run: echo "Repository org - ${{ github.event.repository.owner.login }}"
61+
- run: echo "Repository name - ${{ github.event.repository.name }}"
62+
- run: echo "Repository branch - ${{ needs.set-state.outputs.branch_short_ref }}"
63+
- run: echo "Path prefix - ${{ needs.set-state.outputs.path_prefix }}"
64+
- run: echo "Exclude subfolder - ${{ needs.set-state.outputs.exclude_subfolder }}"
65+
66+
pre-build-dev:
67+
needs: [set-state]
68+
runs-on: ubuntu-latest
69+
if: needs.set-state.outputs.deploy_dev == 'true'
70+
steps:
71+
- name: check dev azure connection string
72+
if: env.AIO_AZURE_DEV_CONNECTION_STRING == null
73+
run: |
74+
echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_DEV_CONNECTION_STRING in Github Secrets"
75+
exit 1
76+
env:
77+
AIO_AZURE_DEV_CONNECTION_STRING: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }}
78+
79+
build-dev:
80+
defaults:
81+
run:
82+
shell: bash
83+
needs: [set-state, pre-build-dev]
84+
runs-on: ubuntu-latest
85+
steps:
86+
- name: Checkout
87+
uses: actions/[email protected] # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
88+
with:
89+
persist-credentials: false
90+
- name: NPM Install
91+
uses: bahmutov/npm-install@v1
92+
- name: Gatsby Cache
93+
uses: actions/cache@v2
94+
with:
95+
path: |
96+
public
97+
.cache
98+
key: ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }}
99+
restore-keys: |
100+
${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-
101+
- name: Clean Cache
102+
if: needs.set-state.outputs.clean_cache == 'true'
103+
run: |
104+
npm run clean
105+
- name: Build
106+
run: |
107+
npm run build
108+
env:
109+
PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build'
110+
PATH_PREFIX: ${{ needs.set-state.outputs.path_prefix }}
111+
GATSBY_ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_DEV_SRC }}
112+
GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS: ${{ secrets.AIO_REPORT_SUITE_DEV}}
113+
GATSBY_ADOBE_ANALYTICS_ENV: 'dev'
114+
REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115+
REPO_OWNER: ${{ github.event.repository.owner.login }}
116+
REPO_NAME: ${{ github.event.repository.name }}
117+
REPO_BRANCH: ${{ needs.set-state.outputs.branch_short_ref }}
118+
GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
119+
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
120+
GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }}
121+
GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }}
122+
GATSBY_IMS_SRC: ${{ secrets.AIO_IMS_DEV_SRC }}
123+
GATSBY_IMS_CONFIG: ${{ secrets.AIO_IMS_DEV_CONFIG }}
124+
GATSBY_ALGOLIA_APP_ID: ${{ secrets.AIO_ALGOLIA_APP_ID }}
125+
GATSBY_ALGOLIA_API_KEY: ${{ secrets.AIO_ALGOLIA_API_KEY }}
126+
GATSBY_ALGOLIA_INDEX_ALL_SRC: ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }}
127+
GATSBY_ALGOLIA_SEARCH_INDEX: ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }}
128+
GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }}
129+
- name: Deploy
130+
uses: icaraps/static-website-deploy@master
131+
with:
132+
enabled-static-website: 'true'
133+
source: 'public'
134+
target: ${{ needs.set-state.outputs.path_prefix }}
135+
connection-string: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }}
136+
remove-existing-files: 'true'
137+
exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }}
138+
- name: Purge Fastly Cache
139+
uses: icaraps/gatsby-fastly-purge-action@master
140+
with:
141+
fastly-token: ${{ secrets.AIO_FASTLY_TOKEN }}
142+
fastly-url: '${{ secrets.AIO_FASTLY_DEV_URL}}${{ needs.set-state.outputs.path_prefix }}'
143+
144+
pre-build-production:
145+
needs: [set-state]
146+
runs-on: ubuntu-latest
147+
if: needs.set-state.outputs.deploy_prod == 'true'
148+
steps:
149+
- name: check prod azure connection string
150+
if: env.AIO_AZURE_PROD_CONNECTION_STRING == null
151+
run: |
152+
echo "::error::Please set the Azure Blob Storage connection string as AIO_AZURE_PROD_CONNECTION_STRING in Github Secrets"
153+
exit 1
154+
env:
155+
AIO_AZURE_PROD_CONNECTION_STRING: ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }}
156+
157+
build-production:
158+
defaults:
159+
run:
160+
shell: bash
161+
needs: [set-state, pre-build-production]
162+
runs-on: ubuntu-latest
163+
steps:
164+
- name: Checkout
165+
uses: actions/[email protected] # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
166+
with:
167+
persist-credentials: false
168+
- name: NPM Install
169+
uses: bahmutov/npm-install@v1
170+
- name: Gatsby Cache
171+
uses: actions/cache@v2
172+
with:
173+
path: |
174+
public
175+
.cache
176+
key: ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }}
177+
restore-keys: |
178+
${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-
179+
- name: Clean Cache
180+
if: needs.set-state.outputs.clean_cache == 'true'
181+
run: |
182+
npm run clean
183+
- name: Build
184+
run: |
185+
npm run build
186+
env:
187+
PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build'
188+
PATH_PREFIX: ${{ needs.set-state.outputs.path_prefix }}
189+
GATSBY_ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_PROD_SRC }}
190+
GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS: ${{ secrets.AIO_REPORT_SUITE_PROD }}
191+
GATSBY_ADOBE_ANALYTICS_ENV: 'production'
192+
REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
193+
REPO_OWNER: ${{ github.event.repository.owner.login }}
194+
REPO_NAME: ${{ github.event.repository.name }}
195+
REPO_BRANCH: ${{ needs.set-state.outputs.branch_short_ref }}
196+
GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
197+
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
198+
GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }}
199+
GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }}
200+
GATSBY_IMS_SRC: ${{ secrets.AIO_IMS_PROD_SRC }}
201+
GATSBY_IMS_CONFIG: ${{ secrets.AIO_IMS_PROD_CONFIG }}
202+
ALGOLIA_WRITE_API_KEY: ${{ secrets.AIO_ALGOLIA_WRITE_API_KEY }}
203+
ALGOLIA_INDEXATION_MODE: ${{ secrets.AIO_ALGOLIA_INDEXATION_MODE }}
204+
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME || github.event.repository.name }}
205+
GATSBY_ALGOLIA_APP_ID: ${{ secrets.AIO_ALGOLIA_APP_ID }}
206+
GATSBY_ALGOLIA_API_KEY: ${{ secrets.AIO_ALGOLIA_API_KEY }}
207+
GATSBY_ALGOLIA_INDEX_ALL_SRC: ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }}
208+
GATSBY_ALGOLIA_SEARCH_INDEX: ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }}
209+
GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }}
210+
- name: Deploy
211+
uses: icaraps/static-website-deploy@master
212+
with:
213+
enabled-static-website: 'true'
214+
source: 'public'
215+
target: ${{ needs.set-state.outputs.path_prefix }}
216+
connection-string: ${{ secrets.AIO_AZURE_PROD_CONNECTION_STRING }}
217+
remove-existing-files: 'true'
218+
exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }}
219+
- name: Purge Fastly Cache
220+
uses: icaraps/gatsby-fastly-purge-action@master
221+
with:
222+
fastly-token: ${{ secrets.AIO_FASTLY_TOKEN }}
223+
fastly-url: '${{ secrets.AIO_FASTLY_PROD_URL }}${{ needs.set-state.outputs.path_prefix }}'

.github/workflows/github-pages.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Github Pages
2+
on:
3+
push:
4+
branches: [main]
5+
jobs:
6+
build-and-deploy:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/[email protected] # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
11+
with:
12+
persist-credentials: false
13+
- name: NPM Install
14+
uses: bahmutov/npm-install@v1
15+
- name: Build
16+
run: |
17+
npm run build
18+
env:
19+
PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build'
20+
PATH_PREFIX: ${{ github.event.repository.name }}
21+
ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_SRC }}
22+
ADOBE_LAUNCH_SRC_INCLUDE_IN_DEVELOPMENT: ${{ secrets.ADOBE_LAUNCH_SRC_INCLUDE_IN_DEVELOPMENT }}
23+
REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
REPO_OWNER: ${{ github.event.repository.owner.login }}
25+
REPO_NAME: ${{ github.event.repository.name }}
26+
REPO_BRANCH: ${{ steps.vars.outputs.BRANCH_SHORT_REF }}
27+
GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
28+
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
29+
GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }}
30+
GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }}
31+
- name: Deploy to GH Pages
32+
uses: JamesIves/[email protected]
33+
with:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
BRANCH: gh-pages # The branch the action should deploy to.
36+
FOLDER: public # The folder the action should deploy.
37+
CLEAN: true # Automatically remove deleted files from the deploy branch

0 commit comments

Comments
 (0)