Update release.yml #30
Workflow file for this run
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 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 | |
build-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-2019 | |
build-name: Windows | |
artifact-extension: .zip | |
build-command: cmake -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 7-Zip (Windows) | |
if: matrix.os == 'windows-2019' | |
run: choco install 7zip | |
- name: Setup MinGW (Windows) | |
if: matrix.os == 'windows-2019' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: UCRT64 | |
update: true | |
install: >- | |
make | |
cmake | |
mingw-w64-ucrt-x86_64-gcc | |
- 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.build-command }} | |
- name: Build (Linux) | |
if: matrix.os == 'ubuntu-22.04' | |
run: cmake --build . | |
- name: Configure CMake (Windows) | |
shell: msys2 {0} | |
if: matrix.os == 'windows-2019' | |
run: ${{ matrix.build-command }} | |
- name: Build (Windows) | |
shell: msys2 {0} | |
if: matrix.os == 'windows-2019' | |
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@v3 | |
with: | |
path: artifacts | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
files: | | |
artifacts/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |