Skip to content

build_all

build_all #95

Workflow file for this run

name: build_all
on:
push:
tags:
- "v*"
workflow_dispatch:
env:
TOOL_NAME: Tuw
jobs:
setup:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.check-tag.outputs.tag }}
wx_version: ${{ steps.wx-version.outputs.version }}
steps:
- name: Check tag
id: check-tag
run: |
if [[ ${{ github.ref }} == refs/tags/v* ]]; then
TAG=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
else
TAG=$(echo ${{ github.sha }} | cut -c1-7)
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
shell: bash
- uses: actions/checkout@v4
- name: Create Release Draft
id: create-release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.check-tag.outputs.tag }}
name: ${{ steps.check-tag.outputs.tag }}
body: |
## Changelog
- First Change
- Second Change
draft: true
prerelease: false
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
exe_ext: .exe
zip_ext: zip
arch: ""
arch_suffix: -x64
- os: windows-2022
exe_ext: .exe
zip_ext: zip
arch: ARM
arch_suffix: -arm64
- os: windows-2022
exe_ext: .exe
zip_ext: zip
arch: UCRT
arch_suffix: 10-x64
- os: macos-14
exe_ext: ""
zip_ext: tar.xz
arch: ""
arch_suffix: ""
name: build-${{ matrix.os }}${{ matrix.arch_suffix }}
runs-on: ${{ matrix.os }}
needs: setup
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Meson for Windows
if: runner.os == 'Windows'
run: pip install meson
- name: Install Meson for Unix
if: runner.os != 'Windows'
run: pip3 install meson ninja
- name: Prepare MSVC for Windows
if: runner.os == 'Windows'
uses: bus1/cabuild/action/msdevshell@v1
with:
architecture: x64
- name: Build exe for Windows
if: runner.os == 'Windows'
run: batch_files/build.bat Release ${{ matrix.arch }}
- name: Build exe for Unix
if: runner.os != 'Windows'
run: bash shell_scripts/build.sh Release
- name: Show info about exe
run: bash shell_scripts/exe_info.sh build/Release${{ matrix.arch }}/${{ env.TOOL_NAME }}${{ matrix.exe_ext }}
shell: bash
- name: Copy files
run: |
mkdir -p archive/${{ env.TOOL_NAME }}
cp build/Release${{ matrix.arch }}/${{ env.TOOL_NAME }}${{ matrix.exe_ext }} archive/${{ env.TOOL_NAME }}
cp examples/other_features/help/gui_definition.json archive/${{ env.TOOL_NAME }}
cp docs/changelog.txt archive/${{ env.TOOL_NAME }}
cp license.txt archive/${{ env.TOOL_NAME }}
shell: bash
- name: Archive release for Windows
if: runner.os == 'Windows'
run: |
cd archive/${{ env.TOOL_NAME }}
powershell Compress-Archive -Force -Path * -Destination ../${{ env.TOOL_NAME }}-${{ needs.setup.outputs.tag }}-${{ runner.os }}${{ matrix.arch_suffix }}.${{ matrix.zip_ext }}
- name: Archive release for Unix
if: runner.os != 'Windows'
run: |
cd archive
tar -Jcvf ${{ env.TOOL_NAME }}-${{ needs.setup.outputs.tag }}-${{ runner.os }}${{ matrix.arch_suffix }}.${{ matrix.zip_ext }} ${{ env.TOOL_NAME }}
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.setup.outputs.tag }} archive/${{ env.TOOL_NAME }}-${{ needs.setup.outputs.tag }}-${{ runner.os }}${{ matrix.arch_suffix }}.${{ matrix.zip_ext }}
build-ubuntu:
name: build-ubuntu-${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
arch: [ x64, arm64 ]
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Build x64 version on Ubuntu 20.04
if : matrix.arch == 'x64'
run: |
sudo apt-get update
docker build -t tuw_ubuntu -f docker/ubuntu.dockerfile ./
- name: Build ARM64 version on Ubuntu 20.04
if : matrix.arch == 'arm64'
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static binfmt-support
docker buildx build --platform linux/arm64 -t tuw_ubuntu -f docker/ubuntu.dockerfile ./
- name: Copy files
run: |
docker run --name tuw_ubuntu tuw_ubuntu
docker cp tuw_ubuntu:/Tuw/build/Release/${{ env.TOOL_NAME }} ./
mkdir -p archive/${{ env.TOOL_NAME }}
cp ${{ env.TOOL_NAME }} archive/${{ env.TOOL_NAME }}
cp examples/other_features/help/gui_definition.json archive/${{ env.TOOL_NAME }}
cp docs/changelog.txt archive/${{ env.TOOL_NAME }}
cp license.txt archive/${{ env.TOOL_NAME }}
shell: bash
- name: Show info about exe
run: bash shell_scripts/exe_info.sh ${{ env.TOOL_NAME }}
shell: bash
- name: Archive release for Unix
run: |
cd archive
tar -Jcvf ${{ env.TOOL_NAME }}-${{ needs.setup.outputs.tag }}-${{ runner.os }}-${{ matrix.arch }}.tar.xz ${{ env.TOOL_NAME }}
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ needs.setup.outputs.tag }} archive/${{ env.TOOL_NAME }}-${{ needs.setup.outputs.tag }}-${{ runner.os }}-${{ matrix.arch }}.tar.xz