Skip to content

Commit ba2329f

Browse files
Merge pull request #153 from AdobeDocs/add-modified-deploy-scripts
add modified deploy scripts
2 parents 62fad4d + 06b1618 commit ba2329f

File tree

2 files changed

+116
-71
lines changed

2 files changed

+116
-71
lines changed

.github/workflows/deploy.yml

Lines changed: 96 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,12 @@ jobs:
6363
- run: echo "Path prefix - ${{ needs.set-state.outputs.path_prefix }}"
6464
- run: echo "Exclude subfolder - ${{ needs.set-state.outputs.exclude_subfolder }}"
6565

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 }}
7866

7967
build-dev:
8068
defaults:
8169
run:
8270
shell: bash
83-
needs: [set-state, pre-build-dev]
71+
needs: [set-state]
8472
runs-on: ubuntu-latest
8573
steps:
8674
- name: Checkout
@@ -105,67 +93,104 @@ jobs:
10593
YARN_ENABLE_IMMUTABLE_INSTALLS: false
10694
with:
10795
cmd: install
108-
109-
- name: Gatsby Cache
110-
uses: actions/cache@v2
111-
with:
112-
path: |
113-
public
114-
.cache
115-
key: ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }}
116-
restore-keys: |
117-
${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-
118-
119-
- name: Clean Cache
120-
if: needs.set-state.outputs.clean_cache == 'true'
96+
- name: Build navigation file
12197
uses: borales/actions-yarn@v3
12298
with:
123-
cmd: clean
99+
cmd: buildNavigation
100+
- name: Publish markdown files in ./src/pages
101+
run: |
102+
bash .github/scripts/publish-mds.sh "./src/pages" "${{ needs.set-state.outputs.path_prefix }}"
124103
125-
- name: Build site
126-
uses: borales/actions-yarn@v3
127-
with:
128-
cmd: build
129-
env:
130-
PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build'
131-
PATH_PREFIX: ${{ needs.set-state.outputs.path_prefix }}
132-
GATSBY_ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_DEV_SRC }}
133-
GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS: ${{ secrets.AIO_REPORT_SUITE_DEV}}
134-
GATSBY_ADOBE_ANALYTICS_ENV: "dev"
135-
REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
136-
REPO_OWNER: ${{ github.event.repository.owner.login }}
137-
REPO_NAME: ${{ github.event.repository.name }}
138-
REPO_BRANCH: ${{ needs.set-state.outputs.branch_short_ref }}
139-
GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
140-
GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
141-
GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }}
142-
GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }}
143-
GATSBY_IMS_SRC: ${{ secrets.AIO_IMS_DEV_SRC }}
144-
GATSBY_IMS_CONFIG: ${{ secrets.AIO_IMS_DEV_CONFIG }}
145-
GATSBY_ALGOLIA_APPLICATION_ID: ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }}
146-
GATSBY_ALGOLIA_SEARCH_API_KEY: ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }}
147-
GATSBY_ALGOLIA_APP_ID: ${{ secrets.AIO_ALGOLIA_APP_ID }}
148-
GATSBY_ALGOLIA_API_KEY: ${{ secrets.AIO_ALGOLIA_API_KEY }}
149-
GATSBY_ALGOLIA_INDEX_ALL_SRC: ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }}
150-
GATSBY_ALGOLIA_SEARCH_INDEX: ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }}
151-
GATSBY_ALGOLIA_INDEX_ENV_PREFIX: ${{ secrets.AIO_ALGOLIA_INDEX_ENV_PREFIX }}
152-
GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }}
153-
GATSBY_SITE_DOMAIN_URL: https://developer-stage.adobe.com
104+
105+
# - name: Gatsby Cache
106+
# uses: actions/cache@v2
107+
# with:
108+
# path: |
109+
# public
110+
# .cache
111+
# key: ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-${{ github.run_id }}
112+
# restore-keys: |
113+
# ${{ needs.set-state.outputs.branch_short_ref }}-gatsby-cache-
154114

155-
- name: Deploy
156-
uses: AdobeDocs/static-website-deploy@master
157-
with:
158-
enabled-static-website: "true"
159-
source: "public"
160-
target: ${{ needs.set-state.outputs.path_prefix }}
161-
connection-string: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }}
162-
remove-existing-files: "true"
163-
exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }}
164-
- name: Purge Fastly Cache
165-
uses: AdobeDocs/gatsby-fastly-purge-action@master
166-
with:
167-
fastly-token: ${{ secrets.AIO_FASTLY_TOKEN }}
168-
fastly-url: "${{ secrets.AIO_FASTLY_DEV_URL}}${{ needs.set-state.outputs.path_prefix }}"
115+
# - name: Clean Cache
116+
# if: needs.set-state.outputs.clean_cache == 'true'
117+
# uses: borales/actions-yarn@v3
118+
# with:
119+
# cmd: clean
120+
121+
# - name: Build site
122+
# uses: borales/actions-yarn@v3
123+
# with:
124+
# cmd: build
125+
# env:
126+
# PREFIX_PATHS: true # equivalent to --prefix-paths flag for 'gatsby build'
127+
# PATH_PREFIX: ${{ needs.set-state.outputs.path_prefix }}
128+
# GATSBY_ADOBE_LAUNCH_SRC: ${{ secrets.AIO_ADOBE_LAUNCH_DEV_SRC }}
129+
# GATSBY_ADDITIONAL_ADOBE_ANALYTICS_ACCOUNTS: ${{ secrets.AIO_REPORT_SUITE_DEV}}
130+
# GATSBY_ADOBE_ANALYTICS_ENV: "dev"
131+
# REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
# REPO_OWNER: ${{ github.event.repository.owner.login }}
133+
# REPO_NAME: ${{ github.event.repository.name }}
134+
# REPO_BRANCH: ${{ needs.set-state.outputs.branch_short_ref }}
135+
# GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}
136+
# GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.GOOGLE_OAUTH_CLIENT_SECRET }}
137+
# GOOGLE_DOCS_TOKEN: ${{ secrets.GOOGLE_DOCS_TOKEN }}
138+
# GOOGLE_DOCS_FOLDER_ID: ${{ secrets.GOOGLE_DOCS_FOLDER_ID }}
139+
# GATSBY_IMS_SRC: ${{ secrets.AIO_IMS_DEV_SRC }}
140+
# GATSBY_IMS_CONFIG: ${{ secrets.AIO_IMS_DEV_CONFIG }}
141+
# GATSBY_ALGOLIA_APPLICATION_ID: ${{ secrets.AIO_ALGOLIA_APPLICATION_ID }}
142+
# GATSBY_ALGOLIA_SEARCH_API_KEY: ${{ secrets.AIO_ALGOLIA_SEARCH_API_KEY }}
143+
# GATSBY_ALGOLIA_APP_ID: ${{ secrets.AIO_ALGOLIA_APP_ID }}
144+
# GATSBY_ALGOLIA_API_KEY: ${{ secrets.AIO_ALGOLIA_API_KEY }}
145+
# GATSBY_ALGOLIA_INDEX_ALL_SRC: ${{ secrets.AIO_ALGOLIA_INDEX_ALL_SRC }}
146+
# GATSBY_ALGOLIA_SEARCH_INDEX: ${{ secrets.AIO_ALGOLIA_SEARCH_INDEX }}
147+
# GATSBY_ALGOLIA_INDEX_ENV_PREFIX: ${{ secrets.AIO_ALGOLIA_INDEX_ENV_PREFIX }}
148+
# GATSBY_FEDS_PRIVACY_ID: ${{ secrets.AIO_FEDS_PRIVACY_ID }}
149+
# GATSBY_SITE_DOMAIN_URL: https://developer-stage.adobe.com
150+
151+
# - name: Deploy
152+
# uses: AdobeDocs/static-website-deploy@master
153+
# with:
154+
# enabled-static-website: "true"
155+
# source: "public"
156+
# target: ${{ needs.set-state.outputs.path_prefix }}
157+
# connection-string: ${{ secrets.AIO_AZURE_DEV_CONNECTION_STRING }}
158+
# remove-existing-files: "true"
159+
# exclude-subfolder: ${{ needs.set-state.outputs.exclude_subfolder }}
160+
# - name: Purge Fastly Cache
161+
# uses: AdobeDocs/gatsby-fastly-purge-action@master
162+
# with:
163+
# fastly-token: ${{ secrets.AIO_FASTLY_TOKEN }}
164+
# fastly-url: "${{ secrets.AIO_FASTLY_DEV_URL}}${{ needs.set-state.outputs.path_prefix }}"
165+
166+
# publish-dev:
167+
# needs: [set-state, build-dev]
168+
# runs-on: ubuntu-latest
169+
# defaults:
170+
# run:
171+
# shell: bash
172+
# if: needs.set-state.outputs.deploy_dev == 'true'
173+
# steps:
174+
# - name: Checkout
175+
# uses: actions/checkout@v3
176+
# - name: Publish markdown files in ./src/pages
177+
# run: |
178+
# bash .github/scripts/publish-mds.sh "./src/pages" "${{ needs.set-state.outputs.path_prefix }}"
179+
180+
181+
publish-production:
182+
needs: [set-state]
183+
runs-on: ubuntu-latest
184+
defaults:
185+
run:
186+
shell: bash
187+
if: needs.set-state.outputs.deploy_prod == 'true'
188+
steps:
189+
- name: Checkout
190+
uses: actions/checkout@v3
191+
- name: Publish markdown files in ./src/pages
192+
run: |
193+
bash .github/scripts/publish-mds.sh "./src/pages" "${{ needs.set-state.outputs.path_prefix }}"
169194
170195
pre-build-production:
171196
needs: [set-state]
@@ -271,4 +296,4 @@ jobs:
271296
uses: AdobeDocs/gatsby-fastly-purge-action@master
272297
with:
273298
fastly-token: ${{ secrets.AIO_FASTLY_TOKEN }}
274-
fastly-url: "${{ secrets.AIO_FASTLY_PROD_URL }}${{ needs.set-state.outputs.path_prefix }}"
299+
fastly-url: "${{ secrets.AIO_FASTLY_PROD_URL }}${{ needs.set-state.outputs.path_prefix }}"

scripts/publish-mds.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
home="https://admin.hlx.page/preview/adobedocs/adp-devsite/main"
4+
root=$1
5+
path_prefix=$2
6+
7+
publish()
8+
{
9+
filename=$1
10+
to_remove="$root/"
11+
relative_filename=${filename/#$to_remove}
12+
url="${home}${path_prefix}${relative_filename}"
13+
14+
echo ""
15+
echo "curl -XPOST -vi ${url}"
16+
curl -XPOST -vi "${url}"
17+
}
18+
19+
# TODO: may want to only certain types of files up
20+
find "${root}" -type f -name "*.md" -exec echo "{}" \; | while read i; do publish $i; done

0 commit comments

Comments
 (0)