-
-
Notifications
You must be signed in to change notification settings - Fork 886
110 lines (94 loc) · 4.19 KB
/
update_db.yml
File metadata and controls
110 lines (94 loc) · 4.19 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
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.13"
# Set git to use CRLF line endings
- name: Configure git CRLF
run: |
git config --global core.autocrlf true
# Clone Detect-It-Easy repository
- name: Clone Detect-It-Easy
run: |
git clone https://github.com/horsicq/Detect-It-Easy DIE
# Create zip archives
- name: Create zip archives
run: |
cd DIE
zip -r ../db.zip db
zip -r ../db_extra.zip db_extra
cd ..
ls -la *.zip # Verify the zip files were created
# Calculate MD5 checksums
- name: Calculate MD5 checksums
id: md5
run: |
DB_MD5=$(md5sum db.zip | awk '{print $1}')
DB_EXTRA_MD5=$(md5sum db_extra.zip | awk '{print $1}')
echo "DB_MD5=$DB_MD5" >> $GITHUB_OUTPUT
echo "DB_EXTRA_MD5=$DB_EXTRA_MD5" >> $GITHUB_OUTPUT
echo "$DB_MD5" >> db.zip.md5
echo "$DB_EXTRA_MD5" >> db_extra.zip.md5
- name: Generate DB Stats
run: |
cd DIE
cd autotools/dbupdater
python --version
python task.py '../../db' > '../../../db_stat.txt'
python task.py '../../db_extra' > '../../../db_extra_stat.txt'
# Get the current date for the update message
- name: Get current date
id: date
run: echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
# Read database stats
- name: Read database stats
id: dbstats
run: |
DB_STATS=$(cat db_stat.txt)
DB_EXTRA_STATS=$(cat db_extra_stat.txt)
echo "DB_STATS<<EOF" >> $GITHUB_OUTPUT
echo "$DB_STATS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
echo "DB_EXTRA_STATS<<EOF" >> $GITHUB_OUTPUT
echo "$DB_EXTRA_STATS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Update the "Current database" pre-release
- name: Update Database Release
uses: softprops/action-gh-release@v1
with:
files: |
db.zip
db.zip.md5
db_extra.zip
db_extra.zip.md5
name: "Current database"
tag_name: current-database
body: |
- db.zip: `${{ steps.md5.outputs.DB_MD5 }}`
- db_extra.zip: `${{ steps.md5.outputs.DB_EXTRA_MD5 }}`
Last updated: ${{ steps.date.outputs.DATE }}
This pre-release contains the latest database files from Detect-It-Easy:
- db.zip: Contains main database files
${{ steps.dbstats.outputs.DB_STATS }}
- db_extra.zip: Contains extra database files
${{ steps.dbstats.outputs.DB_EXTRA_STATS }}
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}