Skip to content

Commit

Permalink
Added workflow for creating a release build (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
oshaked1 committed Jun 6, 2024
1 parent 4ebbfd5 commit 2f0ea31
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/actions/install-wireshark-headers/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Install Wireshark headers
runs:
using: 'composite'
steps:
- name: Configure Wireshark
run: |
mkdir wireshark/build
cmake -G Ninja -B wireshark/build -S wireshark -DENABLE_CCACHE=Yes
shell: bash
- name: Install headers
id: install_headers
run: sudo ninja -C wireshark/build install-headers
continue-on-error: true
shell: bash
# Install headers is not available in older versions, use the full installation instead
- name: Install Wireshark
id: install_wireshark
if: ${{ steps.install_headers.outcome == 'failure' }}
run: |
ninja -C wireshark/build -j$(nproc)
sudo ninja -C wireshark/build install
shell: bash
108 changes: 108 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Release

on:
workflow_dispatch:
inputs:
tag:
description: The tag to be released, e.g. v0.1.0
required: true
release_body:
description: Description of the release
required: false

jobs:
create-release:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Create GitHub release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.tag }}
release_name: ${{ github.event.inputs.tag }}
body: ${{ github.event.inputs.release_body }}
draft: true
prerelease: true
outputs:
upload_url: ${{ steps.create-release.outputs.upload_url }}

build:
name: Build
runs-on: ${{ matrix.os }}
needs: create-release
strategy:
matrix:
# macos-14 is ARM64, macos-13 is x86-64
#os: [ubuntu-latest, macos-14, macos-13, windows-latest]
os: [windows-latest]
wireshark_version: [wireshark-4.2.5]
#include:
# Ubuntu 22.04 Wireshark package version
# - os: ubuntu-latest
# wireshark_version: wireshark-3.6.2

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}

- name: Clone Wireshark
run: git clone --depth 1 --branch ${{ matrix.wireshark_version }} https://github.com/wireshark/wireshark

- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y ninja-build
sudo wireshark/tools/debian-setup.sh
- name: Install dependencies (Macos)
if: matrix.os == 'macos-14' || matrix.os == 'macos-13'
run: wireshark/tools/macos-setup-brew.sh

- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
$ws_version = "${{ matrix.wireshark_version }}"
if ($ws_version -match "\d+\.\d+") {
$ws_version_minor = $matches[0]
}
else {
echo "No match"
exit 1
}
mkdir wireshark-x64-libs-$ws_version_minor
powershell wireshark\tools\win-setup.ps1 -Platform x64 -Destination wireshark-x64-libs-$ws_version_minor
- name: Install Wireshark headers (Unix)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-14' || matrix.os == 'macos-13'
uses: ./.github/actions/install-wireshark-headers

- name: Build Traceeshark (Unix)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-14' || matrix.os == 'macos-13'
run: |
make cmake
make
- name: Create distribution archive (Unix)
id: create_dist
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-14' || matrix.os == 'macos-13'
run: |
make dist
DIST_PATH=$(ls dist/*.zip | head -n 1)
DIST_NAME=$(basename $DIST_PATH)
echo "dist_archive=$DIST_NAME" >> $GITHUB_ENV
- name: Upload distribution archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dist/${{ env.dist_archive }}
asset_name: ${{ env.dist_archive }}
asset_content_type: application/zip

0 comments on commit 2f0ea31

Please sign in to comment.