build_all #91
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_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: ubuntu-20.04 | |
exe_ext: "" | |
zip_ext: tar.bz2 | |
arch: "" | |
arch_suffix: -x64 | |
- os: macos-14 | |
exe_ext: "" | |
zip_ext: tar.bz2 | |
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: Install gtk for Linux | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get -y install libgtk-3-dev | |
- 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-arm64: | |
runs-on: ubuntu-latest | |
needs: setup | |
env: | |
zip_ext: tar.bz2 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build ARM64 version on Ubuntu | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y qemu-user-static binfmt-support | |
docker buildx build --platform linux/arm64 -t tuw_ubuntu_arm -f docker/ubuntu.dockerfile ./ | |
docker run --name tuw_ubuntu_arm tuw_ubuntu_arm | |
docker cp tuw_ubuntu_arm:/Tuw/build/Release/${{ env.TOOL_NAME }} ./ | |
- name: Copy files | |
run: | | |
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 }}-arm64.tar.bz2 ${{ 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 }}-arm64.tar.bz2 |