Skip to content

Commit

Permalink
Automated build and release workflow (#35)
Browse files Browse the repository at this point in the history
* ci: add actions for creating binaries and releases

* ci: merge tag and release workflows for simplicity

* ci: rename some stuff and remove deprecated call in create tag

* ci: bump setup go and include windows files

* ci: remove testing branch trigger

* fix: add master to automated release workflow

* chore: ignore binaries explicitly

* chore: remove brackets on tag_name

* chore: remove extra output

* chore: remove test branch trigger now that retested

---------

Co-authored-by: Jadon Wolffs <[email protected]>
  • Loading branch information
wolffshots and Jadon Wolffs authored Mar 9, 2024
1 parent 6bb147f commit 9efaf83
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 3 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Create tag and draft release

on:
push:
branches:
- main
- master

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Unlock keyring
uses: t1m0thyj/unlock-keyring@v1

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.18

- name: Go mod tidy
run: go mod tidy

- name: Set up MinGW
uses: egor-tensin/setup-mingw@v2

- name: Make windows
run: make -C cmd/main win

- name: Make mac
run: make -C cmd/main mac

- name: Make linux
run: make -C cmd/main linux

- name: Set up Git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Create Tag
id: create_tag
run: |
TAG_DATE=$(date +'%Y%m%d-%H%M%S')
TAG_NAME="v${TAG_DATE}"
echo "Creating tag ${TAG_NAME}"
git tag $TAG_NAME
git push origin $TAG_NAME
echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
- name: Create Draft Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body: |
Note: this was an autogenerated release based on a workflow.
tag_name: ${{ steps.create_tag.outputs.tag_name }}
name: Release ${{ steps.create_tag.outputs.tag_name }}
draft: true
generate_release_notes: true
files: |
cmd/main/picli-mac
cmd/main/picli-linux
cmd/main/picli.exe
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a golang project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go

name: Go
name: Build and test Go

on:
push:
Expand All @@ -14,11 +14,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: t1m0thyj/unlock-keyring@v1

- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.18

Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@

# database file used for testing Pi-CLI's database analytics functions
/cmd/main/*.db

# ignore binaries to prevent accidentally committing
cmd/main/picli-mac
cmd/main/picli-linux
cmd/main/picli.exe

0 comments on commit 9efaf83

Please sign in to comment.