Compile binaries with github actions workflow. #13
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 binaries | ||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
branches: | ||
- alignment-writer-release-testing | ||
jobs: | ||
build_linux-x86_64: | ||
runs-on: ubuntu-latest | ||
container: phusion/holy-build-box-64:3.0.2 | ||
steps: | ||
- name: Install wget | ||
id: install-wget | ||
run: | | ||
yum install -y wget | ||
- name: Create io directories | ||
id: mkdir-io | ||
run: mkdir /io | ||
- name: Download build script | ||
id: dl-build-script | ||
run: wget https://raw.githubusercontent.com/tmaklin/alignment-writer/${{ github.ref_name }}/deploy/linux/build.sh | ||
- name: Compile binary in Holy Build Box container | ||
id: compile-in-container | ||
run: chmod +x build.sh && ./build.sh ${{ github.ref_name }} | ||
- name: Upload linux-x86_64 binary | ||
if: success() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: alignment-writer-${{ github.ref_name }}-x86_64-redhat-linux | ||
path: /io/alignment-writer-${{ github.ref_name }}-x86_64-redhat-linux.tar.gz | ||
build_macOS-x86_64: | ||
runs-on: ubuntu-latest | ||
container: ghcr.io/shepherdjerred/macos-cross-compiler:latest | ||
steps: | ||
- name: Install wget | ||
id: install-wget | ||
run: apt install -y wget | ||
- name: Create io directory | ||
id: mkdir-io | ||
run: mkdir /io && cd /io | ||
- name: Download x86_64 toolchain file | ||
id: dl-toolchain-file | ||
run: wget https://raw.githubusercontent.com/tmaklin/alignment-writer/${{ github.ref_name }}/deploy/macOS/x86-64-toolchain_GNU.cmake && cp x86-64-toolchain_GNU.cmake /io/x86-64-toolchain_GNU.cmake && cp x86-64-toolchain_GNU.cmake /x86-64-toolchain_GNU.cmake | ||
- name: Download build script | ||
id: dl-build-script | ||
run: wget https://raw.githubusercontent.com/tmaklin/alignment-writer/${{ github.ref_name }}/deploy/macOS/build.sh | ||
- name: Compile binary in macOS Cross Compiler container | ||
id: compile-in-container | ||
run: chmod +x build.sh && ./build.sh ${{ github.ref_name }} x86-64 | ||
- name: Upload macOS-x86_64 binary | ||
if: success() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: alignment-writer-${{ github.ref_name }}-x86_64-apple-darwin22 | ||
path: /io/alignment-writer-${{ github.ref_name }}-x86_64-apple-darwin22.tar.gz | ||
build_macOS-arm64: | ||
runs-on: ubuntu-latest | ||
container: ghcr.io/shepherdjerred/macos-cross-compiler:latest | ||
steps: | ||
- name: Install wget | ||
id: install-wget | ||
run: apt install -y wget | ||
- name: Create io directory | ||
id: mkdir-io | ||
run: mkdir /io && cd /io | ||
- name: Download arm64 toolchain file | ||
id: dl-toolchain-file | ||
run: wget https://raw.githubusercontent.com/tmaklin/alignment-writer/${{ github.ref_name }}/deploy/macOS/arm64-toolchain_GNU.cmake && cp arm64-toolchain_GNU.cmake /io/arm64-toolchain_GNU.cmake && cp arm64-toolchain_GNU.cmake /arm64-toolchain_GNU.cmake | ||
- name: Download build script | ||
id: dl-build-script | ||
run: wget https://raw.githubusercontent.com/tmaklin/alignment-writer/${{ github.ref_name }}/deploy/macOS/build.sh | ||
- name: Compile binary in macOS Cross Compiler container | ||
id: compile-in-container | ||
run: chmod +x build.sh && ./build.sh ${{ github.ref_name }} arm64 | ||
- name: Upload macOS-arm64 binary | ||
if: success() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: alignment-writer-${{ github.ref_name }}-aarch64-apple-darwin22 | ||
path: /io/alignment-writer-${{ github.ref_name }}-aarch64-apple-darwin22.tar.gz | ||
create-release: | ||
runs-on: ubuntu-latest | ||
needs: [ build_linux-x86_64, build_macOS-x86_64, build_macOS-arm64 ] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
path: build | ||
- name: Organise files | ||
shell: bash | ||
run: | | ||
cp build/alignment-writer-${{ github.ref_name }}-aarch64-apple-darwin22/alignment-writer-${{ github.ref_name }}-aarch64-apple-darwin22.tar.gz . | ||
cp build/alignment-writer-${{ github.ref_name }}-x86_64-apple-darwin22/alignment-writer-${{ github.ref_name }}-x86_64-apple-darwin22.tar.gz . | ||
cp build/alignment-writer-${{ github.ref_name }}-x86_64-redhat-linux/alignment-writer-${{ github.ref_name }}-x86_64-redhat-linux.tar.gz . | ||
- name: Create release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: Release ${{ github.ref_name }} | ||
draft: false | ||
prerelease: false | ||
fail_on_unmatched_files: true | ||
generate_release_notes: true | ||
files: | | ||
alignment-writer-*.tar.gz |