Skip to content

Commit 76aae99

Browse files
authored
feat: try gatsby js (#25)
* feat: cleanup old files * feat: rename files * feat: update posts formats * feat: add gatsby files * feat: prettier, husky * feat: install plugins and update pages * feat: code format * feat: init github actions * feat: update actions * feat: update pull request actions * feat: reformat actions * feat: build static site * feat: build static site * fix: add sample file * feat: add npm cache * feat: setup ansible * fix: host key checking * fix: disable host checking * feat: compress and save artifact * feat: compress and save artifact * feat: compress and save artifact * feat: compress and save artifact * feat: compress and save artifact * fix: compress * feat: compress artifact * chore: format code * chore: format code * chore: format code * feat: deploy to preview template * feat: try environments * feat: try prod environment * feat: add preview environment * feat: add preview environment * feat: add deployment templates * chore: code format * feat: download artifact * feat: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * fix: download artifact * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: transfer output for deploy * feat: update docker file * feat: update docker file * feat: update docker file
1 parent f2dd4c0 commit 76aae99

93 files changed

Lines changed: 37854 additions & 13107 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@trash07

.github/pull_request_template.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Purpose
2+
3+
Describe the purpose of the pull request and the changes made.
4+
5+
## Related Issues
6+
7+
List any related issues or tickets that this pull request addresses.
8+
9+
## Changes Made
10+
11+
Provide a detailed description of the changes made in this pull request, including any new features, bug
12+
13+
## Change type
14+
15+
- [ ] Bug fix (non-breaking change which fixes an issue)
16+
- [ ] New feature (non-breaking change which adds functionality)
17+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
18+
- [ ] Documentation update (changes to documentation only)
19+
- [ ] Security fix (security vulnerability fix)
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: 2 | Promote to RC
2+
on:
3+
workflow_dispatch:
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v5
9+
- name: Setup Node.js
10+
uses: actions/setup-node@v4
11+
with:
12+
node-version: ${{ vars.NODE_JS_VERSION }}
13+
cache: 'npm'
14+
- name: Build static site
15+
run: |
16+
set -x
17+
npm install
18+
npm run build
19+
- name: Save artifact
20+
env:
21+
REMOTE_FOLDER: '/home/github/dev/artifact/${{ github.repository }}/main'
22+
run: |
23+
set -x
24+
ansible-playbook -i ci/ansible/inventory.ini \
25+
ci/ansible/playbooks/save-artifact.yml \
26+
--extra-vars="ansible_user=${{ secrets.ANSIBLE_USER }} ansible_password=${{ secrets.ANSIBLE_PASS }} current_directory=$(pwd) \
27+
remote_folder=${REMOTE_FOLDER}"
28+
29+
deploy-to-dev:
30+
needs: build
31+
runs-on: ubuntu-latest
32+
environment:
33+
name: dev
34+
url: https://${{ vars.HOST }}
35+
steps:
36+
- name: Login to hub.docker.com
37+
uses: docker/login-action@v3
38+
with:
39+
username: ${{ secrets.DOCKER_USER }}
40+
password: ${{ secrets.DOCKER_PASS }}
41+
- uses: docker/setup-qemu-action@v3
42+
- uses: docker/setup-buildx-action@v3
43+
- name: Download artifact
44+
env:
45+
REMOTE_FOLDER: '/home/github/dev/artifact/${{ github.repository }}/main'
46+
run: |
47+
sshpass -p "${{ secrets.ANSIBLE_PASS }}" scp -r -o "StrictHostKeyChecking=no" "${{secrets.ANSIBLE_USER}}"@tutoriel.dev:"${REMOTE_FOLDER}/artifact.tar.bz2" .
48+
- name: Extract
49+
run: tar -xjf artifact.tar.bz2
50+
- name: List
51+
run: ls -la
52+
- uses: cschleiden/replace-tokens@v1
53+
with:
54+
files: '["ci/k8s/*.yml"]'
55+
env:
56+
ENV: ${{ vars.ENV }}
57+
HOST: ${{ vars.HOST }}
58+
- name: Check replacements
59+
run: cat ci/k8s/*.yml
60+
- name: Build and compress output
61+
run: |
62+
set -x
63+
mkdir -p output/{k8s,public,nginx}
64+
cp -fr ci/k8s/*.yml output/k8s
65+
cp -fr ci/nginx/*.conf output/nginx
66+
cp -fr public/* output/public
67+
cp -f ci/Dockerfile output/Dockerfile
68+
tar -cjf output.tar.bz2 -C output .
69+
- name: Build and push
70+
uses: docker/build-push-action@v6
71+
with:
72+
context: ./output
73+
push: true
74+
tags: lkpeto/tutoriel.dev:${{ vars.ENV }}
75+
- name: Apply changes
76+
env:
77+
REMOTE_FOLDER: '/home/github/build/${{ github.repository }}/${{ github.run_id }}'
78+
run: |
79+
set -x
80+
ansible-playbook -i ci/ansible/inventory.ini \
81+
ci/ansible/playbooks/deploy-output.yml \
82+
--extra-vars="ansible_user=${{ secrets.ANSIBLE_USER }} ansible_password=${{ secrets.ANSIBLE_PASS }} current_directory=$(pwd) \
83+
remote_folder=${REMOTE_FOLDER}"
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: 3 | Release changes
2+
on:
3+
workflow_dispatch:
4+
jobs:
5+
deploy-to-dev:
6+
runs-on: ubuntu-latest
7+
environment:
8+
name: prod
9+
url: https://${{ vars.HOST }}
10+
steps:
11+
- name: Login to hub.docker.com
12+
uses: docker/login-action@v3
13+
with:
14+
username: ${{ secrets.DOCKER_USER }}
15+
password: ${{ secrets.DOCKER_PASS }}
16+
- uses: docker/setup-qemu-action@v3
17+
- uses: docker/setup-buildx-action@v3
18+
- name: Download artifact
19+
env:
20+
REMOTE_FOLDER: '/home/github/dev/artifact/${{ github.repository }}/main'
21+
run: |
22+
sshpass -p "${{ secrets.ANSIBLE_PASS }}" scp -r -o "StrictHostKeyChecking=no" "${{secrets.ANSIBLE_USER}}"@tutoriel.dev:"${REMOTE_FOLDER}/artifact.tar.bz2" .
23+
- name: Extract
24+
run: tar -xjf artifact.tar.bz2
25+
- name: List
26+
run: ls -la
27+
- uses: cschleiden/replace-tokens@v1
28+
with:
29+
files: '["ci/k8s/*.yml"]'
30+
env:
31+
ENV: ${{ vars.ENV }}
32+
HOST: ${{ vars.HOST }}
33+
- name: Check replacements
34+
run: cat ci/k8s/*.yml
35+
- name: Build and compress output
36+
run: |
37+
set -x
38+
mkdir -p output/{k8s,public,nginx}
39+
cp -fr ci/k8s/*.yml output/k8s
40+
cp -fr ci/nginx/*.conf output/nginx
41+
cp -fr public/* output/public
42+
cp -f ci/Dockerfile output/Dockerfile
43+
tar -cjf output.tar.bz2 -C output .
44+
- name: Build and push
45+
uses: docker/build-push-action@v6
46+
with:
47+
context: ./output
48+
push: true
49+
tags: lkpeto/tutoriel.dev:${{ vars.ENV }}
50+
- name: Apply changes
51+
env:
52+
REMOTE_FOLDER: '/home/github/build/${{ github.repository }}/${{ github.run_id }}'
53+
run: |
54+
set -x
55+
ansible-playbook -i ci/ansible/inventory.ini \
56+
ci/ansible/playbooks/deploy-output.yml \
57+
--extra-vars="ansible_user=${{ secrets.ANSIBLE_USER }} ansible_password=${{ secrets.ANSIBLE_PASS }} current_directory=$(pwd) \
58+
remote_folder=${REMOTE_FOLDER}"

.github/workflows/pull-request.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: 1 | Pull request
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- reopened
7+
- synchronize
8+
branches:
9+
- master
10+
- feat/*
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v5
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: ${{ vars.NODE_JS_VERSION }}
20+
cache: 'npm'
21+
- name: Build static site
22+
run: |
23+
set -x
24+
npm install
25+
npm run build
26+
- name: Save artifact
27+
env:
28+
REMOTE_FOLDER: '/home/github/dev/artifact/${{ github.repository }}/pull-request'
29+
run: |
30+
set -x
31+
ansible-playbook -i ci/ansible/inventory.ini \
32+
ci/ansible/playbooks/save-artifact.yml \
33+
--extra-vars="ansible_user=${{ secrets.ANSIBLE_USER }} ansible_password=${{ secrets.ANSIBLE_PASS }} current_directory=$(pwd) \
34+
remote_folder=${REMOTE_FOLDER}"
35+
36+
deploy-to-preview:
37+
needs: build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: preview
41+
url: https://${{ vars.HOST }}
42+
steps:
43+
- name: Login to hub.docker.com
44+
uses: docker/login-action@v3
45+
with:
46+
username: ${{ secrets.DOCKER_USER }}
47+
password: ${{ secrets.DOCKER_PASS }}
48+
- uses: docker/setup-qemu-action@v3
49+
- uses: docker/setup-buildx-action@v3
50+
- name: Download artifact
51+
env:
52+
REMOTE_FOLDER: '/home/github/dev/artifact/${{ github.repository }}/pull-request'
53+
run: |
54+
sshpass -p "${{ secrets.ANSIBLE_PASS }}" scp -r -o "StrictHostKeyChecking=no" "${{secrets.ANSIBLE_USER}}"@tutoriel.dev:"${REMOTE_FOLDER}/artifact.tar.bz2" .
55+
- name: Extract
56+
run: tar -xjf artifact.tar.bz2
57+
- name: List
58+
run: ls -la
59+
- uses: cschleiden/replace-tokens@v1
60+
with:
61+
files: '["ci/k8s/*.yml"]'
62+
env:
63+
ENV: ${{ vars.ENV }}
64+
HOST: ${{ vars.HOST }}
65+
- name: Check replacements
66+
run: cat ci/k8s/*.yml
67+
- name: Build and compress output
68+
run: |
69+
set -x
70+
mkdir -p output/{k8s,public,nginx}
71+
cp -fr ci/k8s/*.yml output/k8s
72+
cp -fr ci/nginx/*.conf output/nginx
73+
cp -fr public/* output/public
74+
cp -f ci/Dockerfile output/Dockerfile
75+
tar -cjf output.tar.bz2 -C output .
76+
- name: Build and push
77+
uses: docker/build-push-action@v6
78+
with:
79+
context: ./output
80+
push: true
81+
tags: lkpeto/tutoriel.dev:${{ vars.ENV }}
82+
- name: Apply changes
83+
env:
84+
REMOTE_FOLDER: '/home/github/build/${{ github.repository }}/${{ github.run_id }}'
85+
run: |
86+
set -x
87+
ansible-playbook -i ci/ansible/inventory.ini \
88+
ci/ansible/playbooks/deploy-output.yml \
89+
--extra-vars="ansible_user=${{ secrets.ANSIBLE_USER }} ansible_password=${{ secrets.ANSIBLE_PASS }} current_directory=$(pwd) \
90+
remote_folder=${REMOTE_FOLDER}"

.gitignore

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
/.idea/
2-
/site/_site/
3-
.jekyll-metadata
4-
/ci/parameters.yml
5-
/site/.jekyll-cache/
6-
/target/
1+
node_modules/
2+
.cache/
3+
public
4+
/.idea/

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npm run format

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules/
2+
.cache/
3+
public
4+
/.idea/
5+
package-lock.json
6+
package.json

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true
4+
}

0 commit comments

Comments
 (0)