Implement custom github release action

This implements the release logic we want via gh cli
to support updating releases with rc tags in place and retain
release notes and other community reactions.
This commit is contained in:
Daniel Hiltgen 2024-06-15 08:26:54 -07:00
parent 4b0050cf0e
commit a12283e2ff

View file

@ -437,6 +437,7 @@ jobs:
env: env:
OLLAMA_SKIP_IMAGE_BUILD: '1' OLLAMA_SKIP_IMAGE_BUILD: '1'
PUSH: '1' PUSH: '1'
GH_TOKEN: ${{ github.token }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set Version - name: Set Version
@ -460,15 +461,20 @@ jobs:
ls -lh dist/ ls -lh dist/
(cd dist; sha256sum * > sha256sum.txt) (cd dist; sha256sum * > sha256sum.txt)
cat dist/sha256sum.txt cat dist/sha256sum.txt
- uses: ncipollo/release-action@v1 - name: Create or update Release
with: run: |
name: ${{ env.RELEASE_VERSION }} echo "Looking for existing release for ${{ env.RELEASE_VERSION }}"
allowUpdates: true OLD_TAG=$(gh release ls --json name,tagName | jq -r ".[] | select(.name == \"${{ env.RELEASE_VERSION }}\") | .tagName")
artifacts: 'dist/*' if [ -n "$OLD_TAG" ]; then
draft: true echo "Updating release ${{ env.RELEASE_VERSION }} to point to new tag ${GITHUB_REF_NAME}"
prerelease: true gh release edit ${OLD_TAG} --tag ${GITHUB_REF_NAME}
omitBodyDuringUpdate: true else
generateReleaseNotes: true echo "Creating new release ${{ env.RELEASE_VERSION }} pointing to tag ${GITHUB_REF_NAME}"
omitDraftDuringUpdate: true gh release create ${GITHUB_REF_NAME} \
omitPrereleaseDuringUpdate: true --title ${{ env.RELEASE_VERSION }} \
replacesArtifacts: true --draft \
--generate-notes \
--prerelease
fi
echo "Uploading artifacts for tag ${GITHUB_REF_NAME}"
gh release upload ${GITHUB_REF_NAME} dist/* --clobber