Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
name: Create Release

'on':
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4

- name: Configure CMake
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release

- name: Build
run: cmake --build build --config Release

- name: Prepare Linux artifact
if: runner.os == 'Linux'
env:
TAG: ${{ github.ref_name }}
run: |
mkdir -p artifacts
cp build/cpp_calc artifacts/cpp_calc-linux-$TAG
chmod +x artifacts/cpp_calc-linux-$TAG

- name: Prepare macOS artifact
if: runner.os == 'macOS'
env:
TAG: ${{ github.ref_name }}
run: |
mkdir -p artifacts
cp build/cpp_calc artifacts/cpp_calc-macos-$TAG
chmod +x artifacts/cpp_calc-macos-$TAG

- name: Prepare Windows artifact
if: runner.os == 'Windows'
env:
TAG: ${{ github.ref_name }}
run: |
mkdir -p artifacts
copy build\Release\cpp_calc.exe `
artifacts\cpp_calc-windows-$env:TAG.exe

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: cpp_calc-${{ runner.os }}
path: artifacts/*

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ github.ref_name }}
draft: false
prerelease: false
generate_release_notes: true
files: artifacts/**/*