Skip to content

Commit

Permalink
feat(ci): migrate publish-cli workflow to Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
esolitos authored and gitbutler-client committed Aug 19, 2024
1 parent 59cbf04 commit 23eabfd
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/publish-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Publish CLI

on:
push:
tags:
- v*
pull_request:
branches:
- master

defaults:
run:
# Specify to ensure "pipefail and errexit" are set.
# Ref: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defaultsrunshell
shell: bash
# This workflow only interacts with the client/go directory, so we can set the working directory here.
working-directory: client/go

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5

- name: Define Build Version
id: define-version
env:
GH_EVENT: ${{ github.event_name }}
GH_REF_NAME: ${{ github.ref_name }}
run: |
if [[ "${{ github.event_name == "push" }}" && "${{ startswith(github.ref, 'refs/tags/v') }}" ]]; then
BUILD_VERSION="${{ github.ref_name }}"
else
BUILD_VERSION="0.0.0-pr-${{ github.run_number }}"
fi
echo "version=${BUILD_VERSION}" >> $GITHUB_ENV
- name: build
env:
VERSION: ${{ steps.define-version.outputs.version }}
run: |
make clean dist
publish-cli-release:
runs-on: macos-latest

if: github.event_name == "push" && startswith(github.ref, 'refs/tags/v')
needs:
- build

container:
image: homebrew/brew:latest

env:
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
GH_TOKEN: ${{ github.token }}

steps:
- uses: actions/checkout@v4

- name: install-dependencies
env:
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
run: |
brew install --quiet gh zip go
# - name: Publish to GitHub Releases
# if: github.event_name == 'push' && github.ref == 'refs/tags/v*'
# run: |
# make -C client/go clean dist-github

# - name: Publish to Homebrew
# if: github.event_name == 'push' && github.ref == 'refs/tags/v*'
# run: |
# make -C client/go clean dist-homebrew

# - name: Install via Homebrew
# if: github.event_name == 'push' && github.ref == 'refs/tags/v*'
# run: |
# make -C client/go install-brew

0 comments on commit 23eabfd

Please sign in to comment.