Skip to content

Update release.yml

Update release.yml #43

Workflow file for this run

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build-and-release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
build-name: Linux
artifact-extension: .tar.gz
config-command: cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_OPTIMIZATION_FAST_MATH=ON -DAPPEND_VERSION=ON -DAPPEND_VERSION_USE_GIT=OFF .
archive-command: tar -czvf
- os: windows-latest
build-name: Windows
artifact-extension: .zip
config-command: cmake -DCMAKE_C_COMPILER=C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER=C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin\g++.exe -DCMAKE_BUILD_TYPE=Release -DENABLE_OPTIMIZATION_FAST_MATH=ON -DAPPEND_VERSION=ON -DAPPEND_VERSION_USE_GIT=OFF .
archive-command: 7z a
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup CMake (Linux)
if: matrix.os == 'ubuntu-22.04'
uses: lukka/get-cmake@latest
- name: Setup Clang (Linux)
if: matrix.os == 'ubuntu-22.04'
uses: KyleMayes/install-llvm-action@v1
with:
version: "16"
- name: Install Windows Dependencies (Windows)
if: matrix.os == 'windows-latest'
run: choco install mingw 7zip
- name: Create build directory
run: mkdir build
- name: Change to build directory
run: cd build
- name: Configure CMake (Linux)
if: matrix.os == 'ubuntu-22.04'
run: ${{ matrix.config-command }}
- name: Build (Linux)
if: matrix.os == 'ubuntu-22.04'
run: cmake --build .
- name: Configure CMake (Windows)
if: matrix.os == 'windows-latest'
run: ${{ matrix.config-command }}
- name: Build (Windows)
if: matrix.os == 'windows-latest'
run: cmake --build .
- name: Archive Artifacts
run: |
executable_name=$(echo Zagreus-v*)
echo "EXECUTABLE_NAME=$executable_name" >> $GITHUB_ENV
mkdir rel
cp "$executable_name" rel/
cp LICENSE README.md rel/
mkdir "rel/source-code"
cp -r src "rel/source-code"
cp -r senjo "rel/source-code"
cp LICENSE "rel/source-code"
cp README.md "rel/source-code"
cp CMakeLists.txt "rel/source-code"
cd rel
${{ matrix.archive-command }} "../$executable_name${{ matrix.artifact-extension }}" *
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.build-name }}
path: "${{ env.EXECUTABLE_NAME }}${{ matrix.artifact-extension }}"
create-release:
needs: build-and-release
runs-on: ubuntu-22.04
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}