Reset release to v0.0.0 #5
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: Semantic Release | |
on: | |
push: | |
branches: | |
- main | |
env: | |
CMAKE_VERSION: "3.27.x" | |
PYTHON_VERSION: "3.13" | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
concurrency: release | |
permissions: | |
id-token: write | |
contents: write | |
outputs: | |
released: ${{ steps.release.outputs.released }} | |
tag: ${{ steps.release.outputs.tag }} | |
sha: ${{ steps.sha.outputs.SHA }} | |
steps: | |
# Note: we need to checkout the repository at the workflow sha in case during the workflow | |
# the branch was updated. To keep PSR working with the configured release branches, | |
# we force a checkout of the desired release branch but at the workflow sha HEAD. | |
- name: Setup | Checkout repository at workflow sha | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.sha }} | |
- name: Setup | Force correct release branch on workflow sha | |
run: | | |
git checkout -B ${{ github.ref_name }} ${{ github.sha }} | |
- name: Action | Semantic Version Release | |
id: release | |
# Adjust tag with desired version if applicable. | |
uses: python-semantic-release/[email protected] | |
with: | |
build: false | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
git_committer_name: "github-actions" | |
git_committer_email: "[email protected]" | |
- name: Action | Get release commit sha | |
id: sha | |
run: echo "SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
- run: echo ${{ steps.sha.outputs.SHA }} | |
package: | |
needs: [release] | |
if: needs.release.outputs.released | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ needs.release.outputs.sha }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: abatilo/actions-poetry@v2 | |
- name: Configure runner (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -yq clang ninja-build rpm | |
- name: Configure runner (Windows) | |
uses: ilammy/msvc-dev-cmd@v1 | |
if: runner.os == 'Windows' | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v2 | |
with: | |
cmake-version: ${{ env.CMAKE_VERSION }} | |
- name: Install Conan | |
run: | | |
poetry install | |
poetry run conan version | |
- name: Restore Conan cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.conan2 | |
key: ${{ runner.os }}-${{ hashFiles('**/conan.lock') }}-Release | |
- name: Install package dependencies | |
run: poetry run conan install . --profile:all=./.conan2/profiles/${{ runner.os }} --output-folder=build --build=missing --lockfile-partial | |
- name: Configure | |
run: cmake --preset conan-release | |
- name: Build | |
run: cmake --build --preset conan-release | |
- name: Package | |
run: cpack --config CPackConfig.cmake | |
working-directory: build | |
- name: Upload to GitHub Release Assets | |
uses: xresloader/upload-to-github-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: "packages/*.rpm; packages/*.exe" | |
tag_name: ${{ needs.release.outputs.tag }} |