-
-
Notifications
You must be signed in to change notification settings - Fork 85
107 lines (98 loc) · 4.82 KB
/
roles.yml
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
name: Cyber Roles Testing
on:
workflow_dispatch:
schedule:
- cron: '0 16 */1 * *'
jobs:
arch-role-testing:
runs-on: ubuntu-latest
container:
image: athenaos/base-devel:latest
options: --privileged
strategy:
fail-fast: false # Ensure all matrix jobs continue even if one fails
matrix:
role_installer:
- { role: "blue", job_name: "💙 Blue Teamer 💙 Arch" }
- { role: "bugbounty", job_name: "🐞 Bug Bounty Hunter 🐞 Arch" }
- { role: "cracker", job_name: "🍘 Cracker Specialist 🍘 Arch" }
- { role: "dos", job_name: "💀 DoS Tester 💀 Arch" }
- { role: "student", job_name: "🎓 Enthusiast Student 🎓 Arch" }
- { role: "forensic", job_name: "🔍 Forensic Analyst 🔍 Arch" }
- { role: "malware", job_name: "🦠 Malware Analyst 🦠 Arch" }
- { role: "mobile", job_name: "📱 Mobile Analyst 📱 Arch" }
- { role: "network", job_name: "🌐 Network Analyst 🌐 Arch" }
- { role: "osint", job_name: "🕵️ OSINT Specialist 🕵️ Arch" }
- { role: "red", job_name: "❤️ Red Teamer ❤️ Arch" }
- { role: "web", job_name: "🕸️ Web Pentester 🕸️ Arch" }
name: ${{ matrix.role_installer.job_name }} Install # Dynamically assign the job name based on the matrix
steps:
- name: Install dependencies
run: pacman -Syyu --noconfirm cyber-toolkit
- name: Install role
run: cyber-toolkit ${{ matrix.role_installer.role }}
nix-role-testing:
runs-on: ubuntu-latest
container:
image: nixos/nix:latest
options: --privileged
strategy:
fail-fast: false # Ensure all matrix jobs continue even if one fails
matrix:
role_installer:
- { role: "blue", job_name: "💙 Blue Teamer 💙 Nix" }
- { role: "bugbounty", job_name: "🐞 Bug Bounty Hunter 🐞 Nix" }
- { role: "cracker", job_name: "🍘 Cracker Specialist 🍘 Nix" }
- { role: "dos", job_name: "💀 DoS Tester 💀 Nix" }
- { role: "student", job_name: "🎓 Enthusiast Student 🎓 Nix" }
- { role: "forensic", job_name: "🔍 Forensic Analyst 🔍 Nix" }
- { role: "malware", job_name: "🦠 Malware Analyst 🦠 Nix" }
- { role: "mobile", job_name: "📱 Mobile Analyst 📱 Nix" }
- { role: "network", job_name: "🌐 Network Analyst 🌐 Nix" }
- { role: "osint", job_name: "🕵️ OSINT Specialist 🕵️ Nix" }
- { role: "red", job_name: "❤️ Red Teamer ❤️ Nix" }
- { role: "web", job_name: "🕸️ Web Pentester 🕸️ Nix" }
name: ${{ matrix.role_installer.job_name }} Install # Dynamically assign the job name based on the matrix
steps:
- name: Install role
run: |
git clone https://github.com/Athena-OS/athena-nix
nix-shell --expr '{ pkgs ? import <nixpkgs> { config.allowUnfree = true; } }: pkgs.mkShell { buildInputs = (import ./athena-nix/nixos/modules/cyber/roles/${{ matrix.role_installer.role }}.nix { inherit pkgs; }); }'
# Final job to send summary to webhook
notify-result:
runs-on: ubuntu-latest
needs: [arch-role-testing, nix-role-testing] # Wait until all matrix jobs complete
if: always() # Ensures this job runs even if any job fails or is canceled
steps:
- name: Generate Job Results Summary
id: generate_summary
run: |
summary="Job Results:"
# Convert the entire 'needs' context to JSON
job_data=$(echo '${{ toJSON(needs) }}' | jq .)
# Loop over each job and collect the results
for job_name in $(echo "$job_data" | jq -r 'keys[]'); do
job_result=$(echo "$job_data" | jq -r --arg job "$job_name" '.[$job].result')
summary="$summary\n$job_name: $job_result"
done
# Output the summary to be used in later steps
echo "$summary"
echo "::set-output name=job-summary::$summary"
- name: Send a request to webhook
run: |
curl -H "Content-Type: application/json" -d '{
"embeds": [{
"type": "rich",
"title": "Workflow Actions",
"thumbnail": {
"url": "https://athenaos.org/_astro/athena-chibi.C4AxdAFD_Z1ifHWb.webp"
},
"author": {
"name": "${{ github.actor }}",
"url": "https://github.com/${{ github.actor }}",
"icon_url": "https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4"
}
}],
"username": "Athena Git Ninja",
"content": "Athena Cyber Roles Test\nBranch: ${{ github.ref }} \nCommit Hash: ${{ github.sha }}\n\n${{ steps.generate_summary.outputs.job-summary }}"
}' ${{ secrets.WEBHOOK_URL }}