Workflow file for this run
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 with Shell Script and Description | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Triggers on tags like v1.0.0 | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for all tags | |
| - name: Set current tag | |
| run: echo "CURRENT_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| - name: Get previous tag | |
| id: previoustag | |
| run: | | |
| # Get the latest tag that is not the current tag | |
| PREVIOUS_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1) 2>/dev/null) | |
| if [ $? -ne 0 ]; then | |
| echo "No previous tag found. Using first commit." | |
| # Use the hash of the very first commit if no previous tag is found | |
| PREVIOUS_TAG=$(git rev-list --max-parents=0 HEAD) | |
| fi | |
| echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_ENV | |
| echo "Previous tag: $PREVIOUS_TAG" | |
| - name: Generate Release Notes | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PREVIOUS_TAG: ${{ env.previous_tag }} | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| run: | | |
| RELEASE_BODY="**Ollama Bash Lib $CURRENT_TAG** | |
| A Bash Library for Ollama | |
| Run LLM prompts straight from your shell, and more | |
| Repo: https://github.com/$GITHUB_REPOSITORY" | |
| # Generate changelog | |
| CHANGELOG=$(git log --pretty=format:"* %s (%h)" $PREVIOUS_TAG..$CURRENT_TAG) | |
| if [ -n "$CHANGELOG" ]; then | |
| RELEASE_BODY="${RELEASE_BODY} | |
| **Full Changelog**: | |
| ${CHANGELOG} | |
| " | |
| fi | |
| # Add link to compare with previous version | |
| RELEASE_BODY="${RELEASE_BODY}See all commits since last release: https://github.com/$GITHUB_REPOSITORY/compare/${PREVIOUS_TAG}...${CURRENT_TAG}" | |
| echo "RELEASENOTES<<EOF" >> $GITHUB_ENV | |
| echo -e "$RELEASE_BODY" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| - name: Create GitHub Release with file ollama_bash_lib.sh | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ env.CURRENT_TAG }} | |
| name: "Ollama Bash Lib ${{ env.CURRENT_TAG }}" | |
| body: ${{ env.RELEASENOTES }} | |
| files: ollama_bash_lib.sh | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |