Skip to content

Commit

Permalink
refactored release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mariotaku committed Mar 4, 2024
1 parent efa4242 commit 9c0e0a0
Showing 1 changed file with 49 additions and 65 deletions.
114 changes: 49 additions & 65 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,88 +3,71 @@ name: Release
on:
release:
types: [ "created" ]
workflow_dispatch:
inputs:
host:
description: 'Host to build for'
required: true
type: choice
options:
- 'macos-12'
- 'macos-13-arm64'
- 'debian-arm64-latest'

permissions:
contents: write

env:
BUILD_TYPE: Release
LANG: 'en_US.UTF-8'

jobs:
macos-x86_64:
name: macOS x86_64
runs-on: macos-12
release:
name: Release for ${{ matrix.display-name }}
strategy:
matrix:
include:
- machine: 'macos-12'
os: 'darwin'
arch: 'x86_64'
display-name: macOS x86_64
- machine: 'macos-13-arm64'
os: 'darwin'
arch: 'arm64'
display-name: macOS ARM64
- machine: 'debian-arm64-latest'
os: 'linux'
arch: 'aarch64'
display-name: Linux ARM64
runs-on: ${{ matrix.machine }}
if: ${{ github.event.inputs.host == matrix.machine }}
env:
ARTIFACT_NAME: arm-webos-linux-gnueabi_sdk-buildroot_${{matrix.os}}-${{matrix.arch}}.tar.bz2

steps:
- uses: actions/checkout@v4

- name: Download MacPorts
uses: robinraju/[email protected]
with:
repository: "macports/macports-base"
latest: true
fileName: "*-12-Monterey.pkg"
out-file-path: "/tmp"

- name: Install MacPorts
run: sudo installer -pkg /tmp/MacPorts-*.pkg -target /

- name: Add MacPorts to PATH
run: echo "/opt/local/bin:/opt/local/sbin" >> $GITHUB_PATH

- name: Install CMake and GCC
run: sudo port install cmake gcc12 gcc_select
- name: Install GCC 12 (Linux)
if: matrix.os == 'linux'
run: |
sudo apt-get update -y
sudo apt-get install -y gcc-12 g++-12
- name: Configure GCC
run: sudo port select --set gcc mp-gcc12
- name: Set Parallel Level (macOS)
if: matrix.os == 'darwin'
run: echo "CMAKE_BUILD_PARALLEL_LEVEL=$(sysctl -n hw.logicalcpu)" >> $GITHUB_ENV

- name: Set Parallel Level
run: echo "CMAKE_BUILD_PARALLEL_LEVEL=$(sysctl -n hw.logicalcpu)" >> $GITHUB_ENV
if: matrix.os == 'linux'
run: echo "CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)" >> $GITHUB_ENV

- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/dist/arm-webos-linux-gnueabi_sdk-buildroot
env:
CC: '/opt/local/bin/gcc'
CXX: '/opt/local/bin/g++'

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Install
run: cmake --install ${{github.workspace}}/build

- name: Make Tarball
run: |
cmake -E tar cjvf arm-webos-linux-gnueabi_sdk-buildroot_darwin-x86_64.tar.bz2 \
arm-webos-linux-gnueabi_sdk-buildroot
working-directory: ${{github.workspace}}/build/dist

- name: Create Release
uses: ncipollo/release-action@v1
with:
name: Release ${{ steps.tagName.outputs.tag }}
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: ${{github.workspace}}/build/dist/arm-webos-linux-gnueabi_sdk-buildroot_darwin-x86_64.tar.bz2

linux-arm64:
name: Linux ARM64
runs-on: debian-arm64-latest

env:
LANG: 'en_US.UTF-8'

steps:
- uses: actions/checkout@v4

- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/dist/arm-webos-linux-gnueabi_sdk-buildroot
CC: 'gcc-12'
CXX: 'g++-12'

- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
Expand All @@ -93,17 +76,18 @@ jobs:
run: cmake --install ${{github.workspace}}/build

- name: Make Tarball
if: github.event_name == 'release'
run: |
cmake -E tar cjvf arm-webos-linux-gnueabi_sdk-buildroot_linux-aarch64.tar.bz2 \
arm-webos-linux-gnueabi_sdk-buildroot
cmake -E tar cjvf ${{env.ARTIFACT_NAME}} arm-webos-linux-gnueabi_sdk-buildroot
working-directory: ${{github.workspace}}/build/dist

- name: Create Release
uses: ncipollo/release-action@v1
if: github.event_name == 'release'
with:
name: Release ${{ steps.tagName.outputs.tag }}
name: Release ${{ github.event.release.tag_name }}
allowUpdates: true
omitNameDuringUpdate: true
omitBodyDuringUpdate: true
omitPrereleaseDuringUpdate: true
artifacts: ${{github.workspace}}/build/dist/arm-webos-linux-gnueabi_sdk-buildroot_linux-aarch64.tar.bz2
artifacts: ${{github.workspace}}/build/dist/${{env.ARTIFACT_NAME}}

0 comments on commit 9c0e0a0

Please sign in to comment.