Skip to content

Deploy release

Deploy release #21

name: "Deploy release"
on:
push:
branches:
- release
workflow_dispatch:
inputs:
isPreRelease:
description: 'Is the build pre release?'
required: true
default: true
type: boolean
env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
jobs:
build-win:
runs-on: [windows-latest]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Add tag data to enviroment
run: |
$output=$(python .github/workflows/get_version.py GViewCore/include/GView.hpp)
echo "GVIEW_VERSION=$output" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Copy static libs from VCPKG
working-directory: "D:/a/GView/GView/bin/Release"
run: cp -R ../../build/vcpkg_installed/x64-windows/lib/*.lib .
- name: List bin artefacts
shell: cmd
run: dir /s "D:/a/GView/GView/bin"
- name: Create archive
run: |
$output=$(7z a "GView-${{ runner.os }}-${{runner.arch}}-${{ env.GVIEW_VERSION }}.zip" D:/a/GView/GView/bin/Release/*.lib)
echo "$output"
$output=$(7z a "GView-${{ runner.os }}-${{runner.arch}}-${{ env.GVIEW_VERSION }}.zip" D:/a/GView/GView/bin/Release/*.exe)
echo "$output"
$output=$(7z a "GView-${{ runner.os }}-${{runner.arch}}-${{ env.GVIEW_VERSION }}.zip" D:/a/GView/GView/bin/Release/*.dll)
echo "$output"
$output=$(7z a "GView-${{ runner.os }}-${{runner.arch}}-${{ env.GVIEW_VERSION }}.zip" D:/a/GView/GView/bin/Release/*/*.tpl)
echo "$output"
$output=$(7z a "GView-${{ runner.os }}-${{runner.arch}}-${{ env.GVIEW_VERSION }}.zip" D:/a/GView/GView/bin/Release/*/*.gpl)
echo "$output"
- name: Store Artifacts
uses: actions/upload-artifact@v3
with:
name: windows_artifacts
path: "GView-${{ runner.os }}-${{runner.arch}}-${{ env.GVIEW_VERSION }}.zip"
retention-days: 1
build-macos:
runs-on: [macos-latest]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
# https://github.com/dotnet/runtime/issues/82240
# temporarily install pkg-config via brew
# - name: Install pkg-config
# run: |
# brew update
# brew install pkg-config
# brew upgrade
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Add tag data to enviroment
run: |
output=$(python .github/workflows/get_version.py GViewCore/include/GView.hpp)
echo "GVIEW_VERSION=$output" >> $GITHUB_ENV
- name: Copy static libs from VCPKG
working-directory: /Users/runner/work/GView/GView/bin/Release
run: cp -R ../../build/vcpkg_installed/x64-osx/lib/*.a .
- name: Copy terminfo from VCPKG
working-directory: /Users/runner/work/GView/GView/bin/Release
run: cp -R ../../build/vcpkg_installed/x64-osx/share/terminfo .
- name: List bin artefacts
run: ls -R /Users/runner/work/GView/GView/bin
- name: Create archive
working-directory: /Users/runner/work/GView/GView/bin/Release
run: |
output=$(zip -9 -r "GView-${{ runner.os }}-${{runner.arch}}-${{ env.GVIEW_VERSION }}.zip" .)
echo "$output"
- name: Store Artifacts
uses: actions/upload-artifact@v3
with:
name: apple_artifacts
path: "/Users/runner/work/GView/GView/bin/Release/GView-${{ runner.os }}-${{runner.arch}}-${{ env.GVIEW_VERSION }}.zip"
retention-days: 1
build-ubuntu:
runs-on: [ubuntu-latest]
env:
CC: gcc-10
CXX: g++-10
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Update
run: sudo apt-get update
- name: Install libx11-dev
run: sudo apt-get install libx11-dev
- name: GCC & G++ multilib
run: sudo apt-get install g++-multilib gcc-multilib -y
- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
- name: Build
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Add tag data to enviroment
run: |
output=$(python .github/workflows/get_version.py GViewCore/include/GView.hpp)
echo "GVIEW_VERSION=$output" >> $GITHUB_ENV
- name: Copy static libs from VCPKG
working-directory: /home/runner/work/GView/GView/bin/Release
run: cp -R ../../build/vcpkg_installed/x64-linux/lib/*.a .
- name: Copy terminfo from VCPKG
working-directory: /home/runner/work/GView/GView/bin/Release
run: cp -R ../../build/vcpkg_installed/x64-linux/share/terminfo .
- name: List bin artefacts
run: ls -R /home/runner/work/GView/GView/bin
- name: Create archive
working-directory: /home/runner/work/GView/GView/bin/Release
run: |
output=$(zip -9 -r "GView-${{ runner.os }}-${{runner.arch}}-${{ env.GVIEW_VERSION }}.zip" .)
echo "$output"
- name: Store Artifacts
uses: actions/upload-artifact@v3
with:
name: linux_artifacts
path: "/home/runner/work/GView/GView/bin/Release/GView-${{ runner.os }}-${{runner.arch}}-${{ env.GVIEW_VERSION }}.zip"
retention-days: 1
publish_job:
name: "Publish to release"
runs-on: [ubuntu-latest]
needs: [build-win, build-ubuntu, build-macos]
steps:
- uses: actions/checkout@v2
- name: Add tag data to enviroment
run: |
output=$(python .github/workflows/get_version.py GViewCore/include/GView.hpp)
echo "GVIEW_VERSION=$output" >> $GITHUB_ENV
- uses: actions/download-artifact@v2
with:
name: windows_artifacts
path: artifacts
- uses: actions/download-artifact@v2
with:
name: linux_artifacts
path: artifacts
- uses: actions/download-artifact@v2
with:
name: apple_artifacts
path: artifacts
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{env.GVIEW_VERSION}}"
prerelease: true # ${{ github.event.inputs.isPreRelease }}
title: Build ${{env.GVIEW_VERSION}}
files: |
artifacts/*.zip