-
Notifications
You must be signed in to change notification settings - Fork 53
143 lines (122 loc) · 4.06 KB
/
Copy pathrelease.yml
File metadata and controls
143 lines (122 loc) · 4.06 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Release
permissions:
contents: write
packages: write
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g., v3.3.0)'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 0
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libpcap-dev
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
cache-dependency-path: go.sum
- name: Verify Go version
run: go version
- name: Build AutoAR binary
run: |
CGO_ENABLED=1 go build -o autoar ./cmd/autoar
chmod +x autoar
- name: Test build
run: |
./autoar --help || true
- name: Gitleaks scan
uses: gitleaks/gitleaks-action@v2
with:
config-path: .gitleaks.toml
- name: Create release archive
run: |
VERSION=${GITHUB_REF_NAME#v}
if [ -z "$VERSION" ]; then
VERSION=${{ github.event.inputs.version }}
fi
# Create release directory
mkdir -p release
# Copy binary
cp autoar release/
# Copy essential directories (submodules are optional)
[ -d nuclei_templates ] && cp -r nuclei_templates/ release/ || echo "nuclei_templates not found, skipping"
[ -d Wordlists ] && cp -r Wordlists/ release/ || echo "Wordlists not found, skipping"
[ -d regexes ] && cp -r regexes/ release/ || echo "regexes not found, skipping"
[ -d templates ] && cp -r templates/ release/ || echo "templates not found, skipping"
# Copy configuration files
[ -f env.example ] && cp env.example release/ || true
[ -f docker-compose.yml ] && cp docker-compose.yml release/ || true
[ -f Dockerfile ] && cp Dockerfile release/ || true
[ -f README.md ] && cp README.md release/ || true
[ -f go.mod ] && cp go.mod release/ || true
[ -f go.sum ] && cp go.sum release/ || true
# Create archives
tar -czf autoar-${GITHUB_REF_NAME}-linux-amd64.tar.gz -C release .
zip -r autoar-${GITHUB_REF_NAME}-linux-amd64.zip release/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
files: |
autoar-*.tar.gz
autoar-*.zip
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/autoar
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64