This commit is contained in:
@@ -32,11 +32,6 @@ jobs:
|
||||
|
||||
- run: go mod tidy
|
||||
|
||||
- uses: golangci/golangci-lint-action@v9.2.0
|
||||
with:
|
||||
args: --timeout=5m
|
||||
skip-cache: true
|
||||
|
||||
- run: go test ./...
|
||||
|
||||
- name: Build ${{ matrix.goos }}-${{ matrix.arch }}
|
||||
@@ -45,60 +40,30 @@ jobs:
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
run: go build -o banforge-${{ matrix.goos }}-${{ matrix.arch }} ./cmd/banforge
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: banforge-${{ matrix.arch }}
|
||||
path: banforge-${{ matrix.goos }}-${{ matrix.arch }}
|
||||
retention-days: 1
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: ./artifacts
|
||||
|
||||
- name: Create Release
|
||||
- name: Upload to release
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
TOKEN: ${{ secrets.TOKEN }}
|
||||
run: |
|
||||
TAG="${{ gitea.ref_name }}"
|
||||
REPO="${{ gitea.repository }}"
|
||||
SERVER="${{ gitea.server_url }}"
|
||||
TOKEN="$TOKEN"
|
||||
|
||||
if [ "${{ matrix.arch }}" = "amd64" ]; then
|
||||
curl -X POST \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"tag_name": "'$TAG'",
|
||||
"name": "Release '$TAG'",
|
||||
"body": "# BanForge '$TAG'\n\nIntrusion Prevention System\n\n## Supported Firewalls\n- UFW\n- iptables\n- nftables\n- firewalld",
|
||||
"body": "# BanForge '$TAG'\n\nIntrusion Prevention System",
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}' \
|
||||
"$SERVER/api/v1/repos/$REPO/releases"
|
||||
"$SERVER/api/v1/repos/$REPO/releases" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
- name: Upload Assets
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
TAG="${{ gitea.ref_name }}"
|
||||
REPO="${{ gitea.repository }}"
|
||||
SERVER="${{ gitea.server_url }}"
|
||||
TOKEN="$GITEA_TOKEN"
|
||||
|
||||
for artifact_dir in artifacts/*/; do
|
||||
for file in "$artifact_dir"*; do
|
||||
[ -f "$file" ] && \
|
||||
curl -X POST \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@$file" \
|
||||
"$SERVER/api/v1/repos/$REPO/releases/tags/$TAG/assets?name=$(basename "$file")"
|
||||
done
|
||||
done
|
||||
--data-binary "@banforge-${{ matrix.goos }}-${{ matrix.arch }}" \
|
||||
"$SERVER/api/v1/repos/$REPO/releases/tags/$TAG/assets?name=banforge-${{ matrix.goos }}-${{ matrix.arch }}"
|
||||
|
||||
Reference in New Issue
Block a user