-
Notifications
You must be signed in to change notification settings - Fork 0
215 lines (208 loc) · 8.12 KB
/
nextjs.yml
File metadata and controls
215 lines (208 loc) · 8.12 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
name: Deploy tkokhing main page to GitHub Pages
on:
repository_dispatch:
types: [app-trigger-rebuild]
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout full branches
uses: actions/checkout@v4
- name: Checkout [heptagoning] private repo
uses: actions/checkout@v4
with:
repository: tkokhing/heptagoning
token: ${{ secrets.PULL_HEPTAGONING_TOKEN }}
path: temp_heptagoning
- name: Move [_kill-chain] folder inside _heptagoning to correct level
id: move_heptagoning_kill-chain
run: |
mkdir -p _heptagoning/_kill-chain
mv ./temp_heptagoning/* ./_heptagoning
rm -rf ./temp_heptagoning
- name: Checkout [tkokhing_lib] private repo
uses: actions/checkout@v4
with:
repository: tkokhing/tkokhing_lib
token: ${{ secrets.PULL_LIB_TOKEN }}
path: temp_lib
- name: Copy and move [_data_exporter] folder to correct level
id: move_setup_data_exporter
run: |
rm -rf src/lib/_data_exporter
mv ./temp_lib/_data_exporter ./src/lib
rm -rf ./temp_lib
- name: Checkout [public] private repo
uses: actions/checkout@v4
with:
repository: tkokhing/tkokhing_public
token: ${{ secrets.PULL_SUB_FOLDERS_OF_PUBLIC_TOKEN }}
path: temp_public
- name: Copy and move [public] folder to correct level
id: move_public_images
run: |
rm -rf public
mkdir public
mv ./temp_public/* ./public
rm -rf ./temp_public ./public/README.md
- name: Checkout [frontier_post] private repo
uses: actions/checkout@v4
with:
repository: tkokhing/frontier_post
token: ${{ secrets.PULL_FRONTIER_TOKEN }}
path: temp_frontier
- name: Move [_frontier] folder post to correct level
id: move_frontier_post
run: |
mkdir -p _frontier_post/_frontier
mv ./temp_frontier/_frontier/*.mdx ./_frontier_post/_frontier
rm -rf ./temp_frontier
- name: Checkout [topic_post] private repo
uses: actions/checkout@v4
with:
repository: tkokhing/topic_post
token: ${{ secrets.PULL_TOPIC_TOKEN }}
path: temp_topic
- name: Move [_topics] folder post to correct level
id: move_topics_post
run: |
mkdir -p _topic_post/_topics
mv ./temp_topic/_topics/*.mdx ./_topic_post/_topics
rm -rf ./temp_topic
- name: Checkout [blog_post] private repo
uses: actions/checkout@v4
with:
repository: tkokhing/blog_post
token: ${{ secrets.PULL_POST_TOKEN }}
path: temp_blog
- name: Move [_posts] to correct level
id: move_blog_post
run: |
mkdir -p _blog_post/_blogs
mv ./temp_blog/_blogs/*.mdx ./_blog_post/_blogs
rm -rf ./temp_blog
- name: Checkout [linux_post] private repo
uses: actions/checkout@v4
with:
repository: tkokhing/linux_post
token: ${{ secrets.PULL_LINUX_TOKEN }}
path: temp_linux
- name: Move [_linux] folder to correct level
id: move_linux_post
run: |
mkdir -p _linux_post/_linux/
mv ./temp_linux/_linux/*.mdx ./_linux_post/_linux/
rm -rf ./temp_linux
- name: Verify PWD
id: present-working-directory
run: |
echo "Present working directory---->: $(pwd)"
echo "Advance check on all contents, incl hidden, are loaded onto present working directory"
ls -lha
echo "Advance check on workflow loaded onto ./.github"
ls -lha ./.github
echo "Advance check on topic post loaded onto ./_topic_post/_topics"
ls -lha ./_topic_post/_topics
echo "Advance check on blog post loaded onto ./_blog_post/_blogs"
ls -lha ./_blog_post/_blogs
echo "Advance check on linux post loaded onto ./_linux_post/_linux/"
ls -lha ./_linux_post/_linux/
echo "Advance check on frontier post loaded onto ./_frontier_post/_frontier/"
ls -lha ./_frontier_post/_frontier
echo "Advance check on linux post loaded onto ./public"
ls -lhaR ./public
- name: Detect package manager
id: detect-package-manager
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "manager=npm" >> $GITHUB_OUTPUT
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Restore cache
uses: actions/cache@v4
with:
path: |
.next/cache
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
- name: Build with Next.js
run: ${{ steps.detect-package-manager.outputs.runner }} next build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
- name: Verify artifact directory
id: Verify-artifacts-directory
run: |
echo "Present deployment directory---->: $(pwd)"
echo "Advance check on all contents, incl hidden, are loaded onto present working directory"
ls -lha
echo "Advance check on workflow loaded onto /home/runner/work/_temp"
ls -lha /home/runner/work/_temp
- name: Clean Up Import Source Files
id: clean-data-fr-data-exporter
run: |
rm -rf ./src/lib/_data_exporter/
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Verify deployment directory
id: present-deployment-directory
run: |
echo "Present deployment directory---->: $(pwd)"
echo "Advance check on all contents, incl hidden, are loaded onto present deployment directory"
ls -lha
echo "Advance check - /home/runner/work/_actions/actions/deploy-pages/v4/src/internal"
ls -lha /home/runner/work/_actions/actions/deploy-pages/v4/src/internal
echo "Advance check - /home/runner/work/_actions/actions/deploy-pages/v4/src"
ls -lha /home/runner/work/_actions/actions/deploy-pages/v4/src
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Verify GitHub working environment state
id: present-working-environment
run: |
echo "process.env.GITHUB_ACTIONS ------>: $(process.env.GITHUB_ACTIONS)"
echo "{environment_variable_name}={value}" >> "$GITHUB_ENV"
echo "Present working environment------>: ${GITHUB_ENV}"
echo "Present deployment directory----->: $(pwd)"
echo "Advance check on all contents, incl hidden, are loaded onto present deployment directory"
ls -lha
- name: Verify deployment url
id: Verify-deployment-URL
run: |
echo "Deployment URL ---->: ${{ steps.deployment.outputs.page_url }}"