Skip to content

Commit ddaf6c2

Browse files
committed
task: Restructure workflow for OpenEdu
Restructure worklfow for OpenEdu Signed-off-by: Gabriel Mocanu <gabi.mocanu98@gmail.com>
1 parent ef93e6f commit ddaf6c2

File tree

8 files changed

+220
-54
lines changed

8 files changed

+220
-54
lines changed

.github/labeler.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
area/reading:
2+
- "**/reading/*"
3+
- "**/reading/**/*"
4+
5+
area/media:
6+
- "**/media/*"
7+
- "**/media/**/*"
8+
9+
area/slides:
10+
- "**/slides/*"
11+
- "**/slides/**/*"
12+
13+
area/guides:
14+
- "**/guides/*"
15+
- "**/guides/**/*"
16+
17+
area/drills:
18+
- "**/drills/*"
19+
- "**/drills/**/*"
20+
21+
area/projects:
22+
- "**/projects/*"
23+
- "**/projects/**/*"
24+
25+
area/infra:
26+
- "common/*"
27+
- "common/**/*"
28+
- "scripts/*"
29+
- "scripts/**/*"
30+
- ".github/*"
31+
- ".github/**/*"
32+
- "Dockerfile"
33+
- "Makefile"
34+
- "config.yaml"

.github/pull_request_template.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Prerequisite Checklist
2+
3+
<!--
4+
Please mark items appropriately:
5+
-->
6+
7+
- [ ] Read the [contribution guidelines](https://github.com/open-education-hub/web-security/blob/main/CONTRIBUTING.md#pull-requests) regarding submitting new changes to the project;
8+
- [ ] Tested your changes against relevant architectures and platforms;
9+
- [ ] Updated relevant documentation (if needed).
10+
11+
## Description of changes
12+
13+
<!--
14+
Please provide a detailed description of the changes made in this new PR.
15+
-->

.github/workflows/actions.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Linter Actions Workflow
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
checkpatch:
10+
name: Checkpatch
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkpatch
14+
uses: open-education-hub/actions/checkpatch@main
15+
with:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
18+
super-linter:
19+
name: Super Linter
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Super Linter
23+
uses: open-education-hub/actions/super-linter@main
24+
with:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
27+
spellcheck:
28+
name: Spellcheck
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Spellcheck
32+
uses: open-education-hub/actions/spellcheck@main
33+
with:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/deployment.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Web Security - Github Page
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Set a branch to deploy
7+
8+
jobs:
9+
deploy:
10+
name: Deploy to GitHub Pages
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- uses: actions/checkout@v2
16+
with:
17+
path: ./repo
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v1
21+
22+
- name: Build and push
23+
uses: docker/build-push-action@v2
24+
with:
25+
context: ./repo
26+
file: ./repo/Dockerfile
27+
push: false
28+
load: true
29+
tags: essentials-security/docusaurus:latest
30+
cache-from: type=gha
31+
cache-to: type=gha
32+
33+
- name: Load image
34+
run: |
35+
mkdir output
36+
docker image list
37+
docker run -v $GITHUB_WORKSPACE/repo:/content -v $GITHUB_WORKSPACE/output:/output web-security/docusaurus:latest
38+
39+
# Popular action to deploy to GitHub Pages:
40+
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
41+
- name: Deploy to GitHub Pages
42+
uses: peaceiris/actions-gh-pages@v3
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
# Build output to publish to the `gh-pages` branch:
46+
publish_dir: ./output
47+
# The following lines assign commit authorship to the official
48+
# GH-Actions bot for deploys to `gh-pages` branch:
49+
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
50+
# The GH actions bot is used by default if you didn't specify the two fields.
51+
# You can swap them out with your own user credentials.
52+
user_name: "github-actions[bot]"
53+
user_email: "github-actions[bot]@users.noreply.github.com"
54+
publish_branch: gh-pages

.github/workflows/labeler.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Labeler Actions Workflow
2+
3+
on:
4+
schedule:
5+
- cron: "0 */12 * * *"
6+
workflow_dispatch:
7+
8+
jobs:
9+
labeler:
10+
name: Labeler
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Labeler
14+
uses: open-education-hub/actions/cron-labeler@main
15+
with:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/linting.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: OpenEduHub - PR Deployment
2+
3+
on:
4+
pull_request_target:
5+
types: [labeled]
6+
7+
jobs:
8+
deploy:
9+
if: ${{ github.event.label.name == 'needs-rendering' }}
10+
name: Deploy to GitHub Pages
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
path: ./repo
19+
repository: ${{ github.event.pull_request.head.repo.full_name }}
20+
ref: ${{ github.head_ref }}
21+
22+
- run: |
23+
cd repo
24+
REF=$(echo ${{ github.event.number }} | sed 's/\//\\\//g')
25+
sed -i "s/baseUrl: \/web-security\//baseUrl: \/web-security\/$REF\//" config.yaml
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v1
29+
30+
- name: Build and push
31+
uses: docker/build-push-action@v3
32+
with:
33+
context: ./repo
34+
file: ./repo/Dockerfile
35+
push: false
36+
load: true
37+
tags: web-security/docusaurus:latest
38+
cache-from: type=gha
39+
cache-to: type=gha
40+
41+
- name: Load Image
42+
run: |
43+
mkdir -p ${{ github.event.number }}
44+
docker image list
45+
docker run -v $GITHUB_WORKSPACE/repo:/content -v $GITHUB_WORKSPACE/${{ github.event.number }}:/output web-security/docusaurus:latest
46+
47+
# Popular action to deploy to GitHub Pages:
48+
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
49+
- name: Deploy to GitHub Pages
50+
uses: peaceiris/actions-gh-pages@v3
51+
with:
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
# Build output to publish to the `gh-pages-pr` branch:
54+
publish_dir: ./${{ github.event.number }}
55+
destination_dir: ${{ github.event.number }}
56+
# The following lines assign commit authorship to the official
57+
# GH-Actions bot for deploys to `gh-pages` branch:
58+
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
59+
# The GH actions bot is used by default if you didn't specify the two fields.
60+
# You can swap them out with your own user credentials.
61+
publish_branch: gh-pages
62+
63+
- name: Add Comment to PR
64+
uses: thollander/actions-comment-pull-request@v2
65+
with:
66+
message: |
67+
Published at http://open-education-hub.github.io/web-security/${{ github.event.number }}/

.github/workflows/push-updates.yml

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

0 commit comments

Comments
 (0)