This commit is contained in:
@@ -32,11 +32,6 @@ jobs:
|
|||||||
|
|
||||||
- run: go mod tidy
|
- run: go mod tidy
|
||||||
|
|
||||||
- uses: golangci/golangci-lint-action@v9.2.0
|
|
||||||
with:
|
|
||||||
args: --timeout=5m
|
|
||||||
skip-cache: true
|
|
||||||
|
|
||||||
- run: go test ./...
|
- run: go test ./...
|
||||||
|
|
||||||
- name: Build ${{ matrix.goos }}-${{ matrix.arch }}
|
- name: Build ${{ matrix.goos }}-${{ matrix.arch }}
|
||||||
@@ -45,60 +40,30 @@ jobs:
|
|||||||
GOARCH: ${{ matrix.arch }}
|
GOARCH: ${{ matrix.arch }}
|
||||||
run: go build -o banforge-${{ matrix.goos }}-${{ matrix.arch }} ./cmd/banforge
|
run: go build -o banforge-${{ matrix.goos }}-${{ matrix.arch }} ./cmd/banforge
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- name: Upload to release
|
||||||
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
|
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
TOKEN: ${{ secrets.TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
TAG="${{ gitea.ref_name }}"
|
TAG="${{ gitea.ref_name }}"
|
||||||
REPO="${{ gitea.repository }}"
|
REPO="${{ gitea.repository }}"
|
||||||
SERVER="${{ gitea.server_url }}"
|
SERVER="${{ gitea.server_url }}"
|
||||||
TOKEN="$TOKEN"
|
|
||||||
|
|
||||||
|
if [ "${{ matrix.arch }}" = "amd64" ]; then
|
||||||
curl -X POST \
|
curl -X POST \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-d '{
|
-d '{
|
||||||
"tag_name": "'$TAG'",
|
"tag_name": "'$TAG'",
|
||||||
"name": "Release '$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,
|
"draft": false,
|
||||||
"prerelease": 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 \
|
curl -X POST \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $TOKEN" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary "@$file" \
|
--data-binary "@banforge-${{ matrix.goos }}-${{ matrix.arch }}" \
|
||||||
"$SERVER/api/v1/repos/$REPO/releases/tags/$TAG/assets?name=$(basename "$file")"
|
"$SERVER/api/v1/repos/$REPO/releases/tags/$TAG/assets?name=banforge-${{ matrix.goos }}-${{ matrix.arch }}"
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|||||||
Reference in New Issue
Block a user