-
Notifications
You must be signed in to change notification settings - Fork 53
142 lines (120 loc) · 3.77 KB
/
Copy pathrelease.yml
File metadata and controls
142 lines (120 loc) · 3.77 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
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: true
fetch-depth: 0
- name: Update submodules (with error handling)
run: |
git submodule sync --recursive || true
git submodule update --init --recursive --force || echo "Warning: Some submodules failed to update"
- 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
cp -r nuclei_templates/ release/ || true
cp -r Wordlists/ release/ || true
cp -r regexes/ release/
cp -r templates/ release/ || true
# Copy configuration files
cp env.example release/
cp docker-compose.yml release/
cp Dockerfile release/
cp README.md release/
cp go.mod go.sum release/
# 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: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
autoar-*.tar.gz
autoar-*.zip
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: true
fetch-depth: 0
- name: Update submodules (with error handling)
run: |
git submodule sync --recursive || true
git submodule update --init --recursive --force || echo "Warning: Some submodules failed to update"
- 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