diff --git a/.github/workflows/publish-tag.yml b/.github/workflows/publish-tag.yml new file mode 100644 index 0000000..116eba9 --- /dev/null +++ b/.github/workflows/publish-tag.yml @@ -0,0 +1,36 @@ +name: Publish Tag + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + publish-tag: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + # Get the version from version.json file and store it in the output file + - name: Get version from version.json + id: retrieve_version + run: | + new_version=$(jq -r '.version' version.json) + if [ -z "$new_version" ]; then + echo "Error: version field is empty or not found in version.json!" + exit 1 + fi + echo "new_version=$new_version" >> "$GITHUB_OUTPUT" + + # Create and push tag to the repository by using the version from the output file + - name: Create and push tag + run: | + new_version=${{ steps.retrieve_version.outputs.new_version }} + + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + git tag -a "$new_version" -m "Release version $new_version" + git push origin "$new_version"