Skip to content

Refactor Snort package creation process and update GitHub Actions wor… #68

Refactor Snort package creation process and update GitHub Actions wor…

Refactor Snort package creation process and update GitHub Actions wor… #68

Workflow file for this run

name: Build, Package, and Release Snort 3
on:
push:
branches:
- "*"
permissions:
contents: write
jobs:
build:
name: Build and Package Snort 3
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y git dpkg-dev
- name: Build and Package Snort 3
run: |
ARCH=${{ matrix.arch }}
bash ./scripts/snort3.sh
mkdir -p /work/packages/$ARCH
mv /work/*.deb /work/packages/$ARCH/
- name: Create ZIP archive of packages
run: |
cd /work/packages/$ARCH
zip snort3-packages-${{ matrix.arch }}.zip *.deb
- name: Upload packages as artifacts
uses: actions/upload-artifact@v4
with:
name: snort3-packages-${{ matrix.arch }}
path: /work/packages/${{ matrix.arch }}/snort3-packages-${{ matrix.arch }}.zip
deploy:
name: Create GitHub Release and Upload Assets
runs-on: ubuntu-latest
needs: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Define tag
id: define-tag
run: echo "RELEASE_TAG=v1.0.${{ github.run_number }}" >> $GITHUB_ENV
- name: Create a release
id: release
uses: actions/create-release@v1
with:
tag_name: ${{ env.RELEASE_TAG }}
release_name: Snort 3 Release
draft: false
prerelease: false
- name: Download amd64 packages
uses: actions/download-artifact@v4
with:
name: snort3-packages-amd64
path: /work/packages/amd64
- name: Download arm64 packages
uses: actions/download-artifact@v4
with:
name: snort3-packages-arm64
path: /work/packages/arm64
- name: Upload amd64 ZIP package to GitHub Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: /work/packages/amd64/snort3-packages-amd64.zip
asset_name: snort3-packages-amd64.zip
asset_content_type: application/zip
- name: Upload arm64 ZIP package to GitHub Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_path: /work/packages/arm64/snort3-packages-arm64.zip
asset_name: snort3-packages-arm64.zip
asset_content_type: application/zip