Update README.md #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
push: | |
branches: | |
- '**' | |
env: | |
VERSION: v1.${{ github.run_number }}.0 | |
jobs: | |
build: | |
name: Build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- 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: ${{ 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 }} |