Skip to content

Commit

Permalink
Update build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
bishoyh authored Nov 11, 2024
1 parent 2116b10 commit 3c5d351
Showing 1 changed file with 74 additions and 4 deletions.
78 changes: 74 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ on:
branches:
- '**'

env:
VERSION: v1.${{ github.run_number }}.0

jobs:
build_and_release:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -15,14 +19,80 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Build Environment
# For Windows, ensure Make is available. You might need to install it or use a different build tool.
if: runner.os == 'Windows'
run: |
choco install make
shell: pwsh

- name: Install Dependencies
run: |
# Add any dependencies installation steps here
echo "Installing dependencies..."
- name: Build
run: make
shell: bash

- name: Archive Binary
run: |
mkdir -p artifacts
# Adjust 'mbox2eml' to your actual binary name
if [ "${{ runner.os }}" == "Windows" ]; then
cp mbox2eml.exe artifacts/mbox2eml-windows.exe
elif [ "${{ runner.os }}" == "macOS" ]; then
cp mbox2eml artifacts/mbox2eml-macos
else
cp mbox2eml artifacts/mbox2eml-linux
fi
shell: bash
if: runner.os != 'Windows'

- name: Archive Binary (Windows)
run: |
mkdir artifacts
cp mbox2eml.exe artifacts/mbox2eml-windows.exe
shell: bash
if: runner.os == 'Windows'

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-binary
path: artifacts/

release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: release-binaries

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
tag_name: 'build-${{ github.run_number }}'
release_name: 'Build ${{ github.run_number }}'
files: 'mbox2eml' # Replace 'myprogram' with your binary's name
tag_name: ${{ env.VERSION }}
files: |
release-binaries/ubuntu-latest-binary/mbox2eml-linux
release-binaries/macos-latest-binary/mbox2eml-macos
release-binaries/windows-latest-binary/mbox2eml-windows.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 3c5d351

Please sign in to comment.