Merge pull request #20 from robzr/dev #20
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: Release | |
on: | |
push: | |
branches: [main] | |
env: | |
GH_TOKEN: ${{ github.token }} | |
jobs: | |
Release: | |
name: Release | |
permissions: write-all | |
runs-on: [ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- id: get-version | |
name: Get Version | |
run: | | |
echo 'json<<EOF' >>"${GITHUB_OUTPUT}" | |
./sver json "$(./sver version)" | \ | |
tee -a "$GITHUB_OUTPUT" | \ | |
jq -C | |
echo EOF >>"${GITHUB_OUTPUT}" | |
- id: is-existing-release | |
name: Checking if Release Exists | |
run: | | |
if [ -n "$( | |
gh release list \ | |
--json tagName \ | |
--jq '.[] | .tagName' | \ | |
./sver filter '${{ fromJSON(steps.get-version.outputs.json).version }}' | |
)" ] ; then | |
echo exists=true >> "$GITHUB_OUTPUT" | |
else | |
echo exists=false >> "$GITHUB_OUTPUT" | |
fi | |
- env: | |
MAJOR: ${{ fromJSON(steps.get-version.outputs.json).major }} | |
MINOR: ${{ fromJSON(steps.get-version.outputs.json).minor }} | |
VERSION: v${{ fromJSON(steps.get-version.outputs.json).version }} | |
if: steps.is-existing-release.outputs.exists == 'false' | |
name: Create New Release | |
run: | | |
gh release \ | |
create "$VERSION" \ | |
--generate-notes \ | |
--latest \ | |
sver | |
git tag -f "v${MAJOR}" | |
git tag -f "v${MAJOR}.${MINOR}" | |
git push -f --tags |