minor updates #82
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: Build and release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- ".github/workflows/build.yml" | |
paths-ignore: | |
- README.md | |
- screenshots/** | |
- renovate.json | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- README.md | |
- screenshots/** | |
- renovate.json | |
permissions: | |
contents: write | |
checks: write | |
pull-requests: write | |
packages: write | |
concurrency: | |
group: build | |
cancel-in-progress: true | |
jobs: | |
build: | |
outputs: | |
new_tag: ${{ steps.get_version.outputs.new_tag }} | |
changelog: ${{ steps.get_version.outputs.changelog }} | |
timeout-minutes: 15 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5 | |
with: | |
go-version: 1.22.3 | |
# Install dependencies | |
- name: Install dependencies | |
run: go mod download | |
# Get the version we're building | |
- name: Get version | |
id: get_version | |
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
release_branches: main | |
pre_release_branches: dev | |
dry_run: true | |
# Build | |
- name: Build | |
shell: bash | |
env: | |
GOLLAMA_VERSION: ${{ steps.get_version.outputs.new_tag }} | |
run: | | |
set -x | |
make ci | |
echo "🎉 Builds completed" >> "$GITHUB_STEP_SUMMARY" | |
- name: Upload artefacts | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 | |
with: | |
name: gollama | |
path: | | |
gollama-*.zip | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
if: ${{ startsWith(github.ref, 'refs/heads/main') && !contains(github.event.head_commit.message, '[skip ci]') }} | |
steps: | |
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 | |
if: ${{ startsWith(github.ref, 'refs/heads/main') && !contains(github.event.head_commit.message, '[skip ci]') }} | |
with: | |
fetch-depth: 0 | |
- name: Download artefacts | |
uses: actions/download-artifact@main | |
with: | |
pattern: gollama-*.zip | |
path: . | |
# Publish | |
- name: Create a GitHub release | |
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1 | |
if: ${{ startsWith(github.ref, 'refs/heads/main') && !contains(github.event.head_commit.message, '[skip ci]') }} | |
with: | |
tag: ${{ needs.build.outputs.new_tag }} | |
name: Release ${{ needs.build.outputs.new_tag }} | |
body: ${{ needs.build.outputs.changelog }} | |
generateReleaseNotes: true | |
allowUpdates: true | |
makeLatest: true | |
prerelease: ${{ !startsWith(github.ref, 'refs/heads/main') }} | |
draft: ${{ !startsWith(github.ref, 'refs/heads/main') }} | |
artifactErrorsFailBuild: true | |
artifacts: | | |
gollama-*.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Bump version | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
release_branches: main | |
pre_release_branches: dev | |
dry_run: ${{ !startsWith(github.ref, 'refs/heads/main') }} | |
custom_tag: ${{ needs.build.outputs.new_tag }} | |
# if the workflow is cancelled, don't mark the workflow as failed | |
done: | |
runs-on: ubuntu-latest | |
if: cancelled() | |
steps: | |
- name: Workflow cancelled | |
run: echo "Workflow was cancelled" |