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 922d1c0 commit 87d6b11
Showing 1 changed file with 12 additions and 57 deletions.
69 changes: 12 additions & 57 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,25 @@
name: Build and Release

on:
release:
types: [published]
push:
branches:
- '**'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Build mbox2eml
run: |
mkdir -p build
make
cp mbox2eml build/mbox2eml
shell: bash

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

release:
needs: build
build_and_release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
- name: Checkout Code
uses: actions/checkout@v3

- name: Download binaries
uses: actions/download-artifact@v3
with:
name: mbox2eml-ubuntu-latest
path: mbox2eml-ubuntu-latest

- name: Download binaries for macOS
uses: actions/download-artifact@v3
with:
name: mbox2eml-macos-latest
path: mbox2eml-macos-latest


- name: Build
run: make

- name: Upload Release Asset for Linux
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mbox2eml-ubuntu-latest/mbox2eml
asset_name: mbox2eml-linux
asset_content_type: application/octet-stream

- name: Upload Release Asset for macOS
uses: actions/upload-release-asset@v1
tag_name: 'build-${{ github.run_number }}'
release_name: 'Build ${{ github.run_number }}'
files: 'mbox2eml' # Replace 'myprogram' with your binary's name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: mbox2eml-macos-latest/mbox2eml
asset_name: mbox2eml-macos
asset_content_type: application/octet-stream

0 comments on commit 87d6b11

Please sign in to comment.