Skip to content

Commit 20876d8

Browse files
Move into own workflow
1 parent ba843a5 commit 20876d8

File tree

2 files changed

+98
-83
lines changed

2 files changed

+98
-83
lines changed

Diff for: .github/workflows/configure-prebuild-repo.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: configure prebuild repo
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
prebuild:
7+
type: string
8+
project-name:
9+
type: string
10+
repo:
11+
type: string
12+
13+
jobs:
14+
configure:
15+
name: Insert PR changes into prebuild
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Set up Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
23+
- name: Checkout versioning action
24+
uses: actions/checkout@v4
25+
with:
26+
repository: elastic/workflows
27+
path: ./workflows
28+
29+
- name: Install versioning action dependencies
30+
run: npm install
31+
working-directory: ./workflows/.github/actions/version-content
32+
33+
- name: Configure versioned prebuild repo
34+
uses: ./workflows/.github/actions/version-content
35+
with:
36+
prebuild: ${{ inputs.prebuild }}
37+
site-repo: ${{ inputs.repo }}
38+
content-repo: ${{ github.repository }}
39+
base-ref: ${{ github.base_ref }}

Diff for: .github/workflows/docs-elastic-staging-publish.yml

+59-83
Original file line numberDiff line numberDiff line change
@@ -61,86 +61,62 @@ jobs:
6161
token: ${{ secrets.VERCEL_GITHUB_TOKEN }}
6262
path: ${{ github.workspace }}/${{ env.PREBUILD }}
6363

64-
- name: Temp sources override
65-
shell: bash
66-
run: cp -f ${{ github.workspace }}/${{ env.PREBUILD }}/.scaffold/content.js ${{ github.workspace }}/${{ env.SITE_REPO }}/config/.
67-
68-
- name: Portal
69-
shell: bash
70-
run: |
71-
mkdir -p ${{ github.workspace }}/${{ env.PREBUILD }}/${{ github.event.repository.name }}
72-
rm -rf ${{ github.workspace }}/${{ env.PREBUILD }}/${{ github.event.repository.name }}/*
73-
rsync --ignore-missing-args -zavpm --no-l \
74-
--exclude='cats.mdx' \
75-
--exclude='infrastructure/ansible/systests/*' \
76-
--include='*.docnav.json' \
77-
--include='*.apidocs.json' \
78-
--include='*.mdx' \
79-
--include='*.png' \
80-
--include='*.gif' \
81-
--include='*.jpg' \
82-
--include='*.svg' \
83-
--include='*.jpeg' \
84-
--include='*.webp' \
85-
--include='*.devdocs.json' \
86-
--include='*/' \
87-
--exclude='*' \
88-
${{ github.workspace }}/tmp/ \
89-
${{ github.workspace }}/${{ env.PREBUILD }}/${{ github.event.repository.name }}/
90-
91-
- name: Set up Node.js
92-
uses: actions/setup-node@v4
93-
with:
94-
node-version: '20'
95-
96-
- name: Checkout versioning action
97-
uses: actions/checkout@v4
98-
with:
99-
repository: elastic/workflows
100-
path: ./workflows
101-
102-
- name: Install versioning action dependencies
103-
run: npm install
104-
working-directory: ./workflows/.github/actions/version-content
105-
106-
- name: Configure versioned prebuild repo
107-
uses: ./workflows/.github/actions/version-content
108-
with:
109-
prebuild: ${{ env.PREBUILD }}
110-
site-repo: ${{ env.SITE_REPO }}
111-
content-repo: ${{ github.repository }}
112-
base-ref: ${{ github.base_ref }}
113-
114-
- name: Tidy before Vercel CLI run
115-
if: github.event.pull_request.merged != true && github.event.pull_request.closed != true
116-
shell: bash
117-
run: |
118-
mkdir ${{ github.workspace }}/build/
119-
mv ${{ github.workspace }}/${{ env.PREBUILD }} ${{ github.workspace }}/build/
120-
mv ${{ github.workspace }}/${{ env.SITE_REPO }} ${{ github.workspace }}/build/
121-
122-
- name: Generate preview
123-
if: github.event.pull_request.merged != true && github.event.pull_request.closed != true
124-
id: vercel-deploy
125-
uses: elastic/[email protected]
126-
continue-on-error: false
127-
with:
128-
vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
129-
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} #Required
130-
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_STAGING_PREVIEW_DOCS }} #Required
131-
vercel-project-name: co-preview-docs
132-
working-directory: ${{ github.workspace }}/build/
133-
github-token: ${{ secrets.VERCEL_GITHUB_TOKEN }} #Optional
134-
github-comment: true # Otherwise need github-token (VERCEL_GITHUB_TOKEN)
135-
136-
- name: Portal for deploy
137-
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == github.event.pull_request.base.repo.default_branch
138-
shell: bash
139-
run: |
140-
cd ${{ github.workspace }}/${{ env.PREBUILD }}
141-
git config user.name elasticdocs
142-
git config user.email [email protected]
143-
git pull
144-
git add .
145-
git commit -m "New content from https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
146-
git push https://${{ secrets.VERCEL_GITHUB_TOKEN }}@github.com/elastic/${{ env.PREBUILD }}
64+
# - name: Portal
65+
# shell: bash
66+
# run: |
67+
# mkdir -p ${{ github.workspace }}/${{ env.PREBUILD }}/${{ github.event.repository.name }}
68+
# rm -rf ${{ github.workspace }}/${{ env.PREBUILD }}/${{ github.event.repository.name }}/*
69+
# rsync --ignore-missing-args -zavpm --no-l \
70+
# --exclude='cats.mdx' \
71+
# --exclude='infrastructure/ansible/systests/*' \
72+
# --include='*.docnav.json' \
73+
# --include='*.apidocs.json' \
74+
# --include='*.mdx' \
75+
# --include='*.png' \
76+
# --include='*.gif' \
77+
# --include='*.jpg' \
78+
# --include='*.svg' \
79+
# --include='*.jpeg' \
80+
# --include='*.webp' \
81+
# --include='*.devdocs.json' \
82+
# --include='*/' \
83+
# --exclude='*' \
84+
# ${{ github.workspace }}/tmp/ \
85+
# ${{ github.workspace }}/${{ env.PREBUILD }}/${{ github.event.repository.name }}/
86+
87+
- name: Insert PR changes into prebuild
88+
uses: elastic/workflows/.github/workflows/configure-prebuild-repo.yml@main
89+
90+
# - name: Tidy before Vercel CLI run
91+
# if: github.event.pull_request.merged != true && github.event.pull_request.closed != true
92+
# shell: bash
93+
# run: |
94+
# mkdir ${{ github.workspace }}/build/
95+
# mv ${{ github.workspace }}/${{ env.PREBUILD }} ${{ github.workspace }}/build/
96+
# mv ${{ github.workspace }}/${{ env.SITE_REPO }} ${{ github.workspace }}/build/
97+
98+
# - name: Generate preview
99+
# if: github.event.pull_request.merged != true && github.event.pull_request.closed != true
100+
# id: vercel-deploy
101+
# uses: elastic/[email protected]
102+
# continue-on-error: false
103+
# with:
104+
# vercel-token: ${{ secrets.VERCEL_TOKEN }} # Required
105+
# vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} #Required
106+
# vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_STAGING_PREVIEW_DOCS }} #Required
107+
# vercel-project-name: co-preview-docs
108+
# working-directory: ${{ github.workspace }}/build/
109+
# github-token: ${{ secrets.VERCEL_GITHUB_TOKEN }} #Optional
110+
# github-comment: true # Otherwise need github-token (VERCEL_GITHUB_TOKEN)
111+
112+
# - name: Portal for deploy
113+
# if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == github.event.pull_request.base.repo.default_branch
114+
# shell: bash
115+
# run: |
116+
# cd ${{ github.workspace }}/${{ env.PREBUILD }}
117+
# git config user.name elasticdocs
118+
# git config user.email [email protected]
119+
# git pull
120+
# git add .
121+
# git commit -m "New content from https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}"
122+
# git push https://${{ secrets.VERCEL_GITHUB_TOKEN }}@github.com/elastic/${{ env.PREBUILD }}

0 commit comments

Comments
 (0)