Update README.md #13
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: Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
Build: | |
uses: ./.github/workflows/build.yaml | |
Publish: | |
runs-on: ubuntu-latest | |
needs: [Build] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fetch tags | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || echo "No tags fetched" | |
- name: Get project version | |
id: project_version | |
run: echo "VERSION=$(grep -E "\s+VERSION" CMakeLists.txt | xargs | cut -d' ' -f 2)" >> $GITHUB_OUTPUT | |
- name: Get tag status | |
id: tagstatus | |
run: echo "TAG_EXISTS=$(git show-ref --tags --verify --quiet -- 'refs/tags/v${{ steps.project_version.outputs.VERSION }}' && echo 1 || echo 0)" >> $GITHUB_OUTPUT | |
- name: Print version and status | |
run: | | |
echo "Version: ${{ steps.project_version.outputs.VERSION }}" | |
echo "Aready exists: ${{ steps.tagstatus.outputs.TAG_EXISTS }}" | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
if: steps.tagstatus.outputs.TAG_EXISTS == 0 | |
with: | |
name: dist | |
path: dist | |
- name: Tag release | |
uses: rickstaa/action-create-tag@v1 | |
if: steps.tagstatus.outputs.TAG_EXISTS == 0 | |
with: | |
tag: "v${{ steps.project_version.outputs.VERSION }}" | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: steps.tagstatus.outputs.TAG_EXISTS == 0 | |
with: | |
tag_name: "v${{ steps.project_version.outputs.VERSION }}" | |
files: dist/* | |
draft: true |