Skip to content

Commit

Permalink
Merge pull request CanastaWiki#70 from CanastaWiki/github-actions
Browse files Browse the repository at this point in the history
Add github actions workflow to build and release
  • Loading branch information
jeffw16 authored Mar 14, 2023
2 parents 4d0c740 + c25a533 commit 57e3620
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This workflow will build and publish a release of Canasta-CLI on pushing to the 'releases' branch.
# It also automatically grabs the current latest version and increments the minor version.

name: Go build

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Build
run: sh build.sh
- name: Upload executable for job build
uses: actions/upload-artifact@v3
with:
name: executable
path: ./Canasta-CLI-Go
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download executable
uses: actions/download-artifact@v3
with:
name: executable
- name: Rename executable
run: mv Canasta-CLI-Go canasta
- name: Generate Version Tag
id: generate
run: |
latest_version_raw="$(curl -s https://api.github.com/repos/${{ github.repository }}/releases | grep -m 1 "html_url" | rev | cut -d/ -f1 | rev )"
latest_version="${latest_version_raw%??}"
major_version=$(echo $latest_version | cut -d. -f1 | cut -dv -f2)
minor_version=$(echo $latest_version | cut -d. -f2)
patch_version=$(echo $latest_version | cut -d. -f3)
minor_version=$(expr $minor_version + 1)
new_version=$(echo "v$major_version.$minor_version.$patch_version")
echo $new_version
echo "new_version=$new_version" >> $GITHUB_OUTPUT
- name: Publish
uses: softprops/action-gh-release@v1
id: publish
with:
draft: false
tag_name: ${{ steps.generate.outputs.new_version }}
fail_on_unmatched_files: true
generate_release_notes: true
append_body: true
files: canasta

0 comments on commit 57e3620

Please sign in to comment.