-
Notifications
You must be signed in to change notification settings - Fork 12
75 lines (67 loc) · 2.54 KB
/
Copy pathexport-ghidra.yml
File metadata and controls
75 lines (67 loc) · 2.54 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
name: Export Ghidra Database
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
env:
GHIDRA_VERSION: 11.1.2
GHIDRA_DATE: 20240709
GHIDRA_SERVER: "roblab.la"
GHIDRA_PROJECT_NAME: "Touhou"
GHIDRA_FOLDER: "Touhou 08 - Imperishable Night"
GHIDRA_FILE_NAME: "th08_v100d.exe"
RE_REPO_ORG: happyhavoc
RE_REPO_NAME: th08-re
jobs:
export-ghidra:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- branch: xml
type: xml
- branch: main
type: decomp
permissions:
contents: write
steps:
- uses: actions/checkout@v4
# Don't use actions/checkout@v4 because hurr durr it be broken: https://github.com/actions/checkout/issues/1477
- name: Clone export repo
run: |
git clone "https://github.com/$RE_REPO_ORG/$RE_REPO_NAME" "$RE_REPO_NAME"
if git -C "$RE_REPO_NAME" rev-parse --verify "origin/${{ matrix.branch }}" ; then
# Switch to existing branch
git -C "$RE_REPO_NAME" switch -c "${{ matrix.branch }}" "origin/${{ matrix.branch }}"
else
# Create branch
git -C "$RE_REPO_NAME" switch --orphan "${{ matrix.branch }}"
fi
- name: Install python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Get ghidra
run: |
curl -L https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${GHIDRA_VERSION}_build/ghidra_${GHIDRA_VERSION}_PUBLIC_${GHIDRA_DATE}.zip -o /tmp/ghidra.zip
unzip -d /tmp /tmp/ghidra.zip
echo /tmp/ghidra_*/support >> $GITHUB_PATH
- name: Export ghidra
run: |
echo "$GHIDRA_SSH_AUTH" > ssh_key
# Use user-maps if it exists
USER_MAPS_ARG=""
if [[ -e config/ghidra-user-maps.toml ]]; then
USER_MAPS_ARG="--user-mappings=config/ghidra-user-maps.toml"
fi
python scripts/export_ghidra_database.py $USER_MAPS_ARG --username github-action --ssh-key ssh_key --program "$GHIDRA_FILE_NAME" --project-name "$GHIDRA_PROJECT_NAME" "ghidra://$GHIDRA_SERVER/$GHIDRA_PROJECT_NAME/$GHIDRA_FOLDER" "$RE_REPO_NAME" ${{ matrix.type }}
rm ssh_key
env: # Or as an environment variable
GHIDRA_SSH_AUTH: ${{ secrets.GHIDRA_SSH_AUTH }}
- name: Push export repo
run: |
# Use PAT to push repo
git -C "$RE_REPO_NAME" remote set-url origin "https://$GH_TOKEN_PAT@github.com/$RE_REPO_ORG/$RE_REPO_NAME"
git -C "$RE_REPO_NAME" push origin HEAD
env:
GH_TOKEN_PAT: ${{ secrets.GH_TOKEN_PAT }}