Skip to content

Commit

Permalink
Refactor Snort package creation process
Browse files Browse the repository at this point in the history
  • Loading branch information
bengo237 committed Aug 29, 2024
1 parent 548bf88 commit f38e6a5
Showing 1 changed file with 24 additions and 23 deletions.
47 changes: 24 additions & 23 deletions .github/workflows/package-snort.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- "*"

permissions:
contents: write

jobs:
build:
name: Build and Package Snort 3
Expand Down Expand Up @@ -41,36 +44,34 @@ jobs:
path: /work/packages/${{ matrix.arch }}

deploy:
name: Publish to GitHub Packages
name: Publish to GitHub Releases
runs-on: ubuntu-latest
needs: build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Create work directory
run: sudo mkdir -p /work && sudo chmod -R 777 /work

- name: Download amd64 packages
uses: actions/download-artifact@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
name: snort3-packages-amd64
path: /work/packages/amd64
tag_name: ${{ github.sha }}
release_name: Snort 3 Packages ${{ github.sha }}
draft: false
prerelease: false

- name: Download arm64 packages
uses: actions/download-artifact@v4
- name: Upload amd64 packages
uses: actions/upload-release-asset@v1
with:
name: snort3-packages-arm64
path: /work/packages/arm64
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /work/packages/amd64/*.deb
asset_name: snort3-amd64.deb
asset_content_type: application/octet-stream

- name: Publish packages
run: |
for ARCH in amd64 arm64; do
cd /work/packages/$ARCH
for file in *.deb; do
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: $(file --mime-type -b $file)" \
--data-binary @$file \
"https://uploads.github.com/repos/ADORSYS-GIS/wazuh-snort/releases/assets?name=$(basename $file)"
done
done
- name: Upload arm64 packages
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: /work/packages/arm64/*.deb
asset_name: snort3-arm64.deb
asset_content_type: application/octet-stream

0 comments on commit f38e6a5

Please sign in to comment.