diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4a40d41 --- /dev/null +++ b/.github/workflows/release.yml @@ -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/**/*