Initial commit: libcosy v1.0.0 #1
This file contains hidden or 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: Release on Version Bump | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - 'Rosy.toml' | |
| permissions: | |
| contents: write | |
| jobs: | |
| check-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| tag: ${{ steps.version.outputs.tag }} | |
| is_new: ${{ steps.check.outputs.is_new }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract version from Rosy.toml | |
| id: version | |
| run: | | |
| # ^version anchors to the line literally starting with "version" — | |
| # this skips the "rosy_version" entry, which starts with "rosy_". | |
| VERSION=$(grep '^version' Rosy.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "tag=v$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Check if tag already exists | |
| id: check | |
| run: | | |
| if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then | |
| echo "is_new=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "is_new=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| release: | |
| needs: check-version | |
| if: needs.check-version.outputs.is_new == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Create git tag | |
| run: | | |
| git tag ${{ needs.check-version.outputs.tag }} | |
| git push origin ${{ needs.check-version.outputs.tag }} | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.check-version.outputs.tag }} | |
| generate_release_notes: true |