Skip to content

Commit

Permalink
Merge pull request #16 from m-triassi/13-build-on-release
Browse files Browse the repository at this point in the history
major(release): Add automated build pipeline
  • Loading branch information
m-triassi authored Dec 11, 2023
2 parents e750ac6 + 45a7864 commit 2f91097
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 5 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Generate release-artifacts

on:
push:
branches: ["main"]

jobs:
generate:
name: Generate cross-platform builds
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3

- name: Set-up Golang
uses: actions/setup-go@v4
with:
go-version: '^1.21.3'
cache: true
cache-dependency-path: go.sum

- name: Generate changelog and tag release
id: changelog
uses: TriPSs/conventional-changelog-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
output-file: CHANGELOG.md
input-file: CHANGELOG.md
fallback-version: 0.0.0
skip-version-file: true
skip-commit: true
git-push: false
skip-tag: true

- name: Write changelog to temp file for goreleaser
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: echo "${{ steps.changelog.outputs.clean_changelog }}" > ${{ runner.temp }}/CHANGELOG.md

- name: Commit release
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
git config user.name "Massimo Triassi"
git config user.email "[email protected]"
git add .
git commit -m "chore(release): ${{ steps.changelog.outputs.tag }}"
- name: Tag commit
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: git tag ${{ steps.changelog.outputs.tag }}

- name: Push changelog
if: ${{ steps.changelog.outputs.skipped == 'false' }}
run: |
git push origin main
- name: Release new CLI version
if: ${{ steps.changelog.outputs.skipped == 'false' }}
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.RELEASER_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
bin
dist
48 changes: 48 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
project_name: wowforge-cli
builds:
- dir: .
goos:
- linux
- darwin
goarch:
- amd64
- arm64
ldflags:
- -X "main.version=v{{ trimprefix .Version "v" }}"
archives:
- format: tar.gz
wrap_in_directory: false
checksum:
name_template: "checksums.txt"
changelog:
sort: asc
filters:
exclude:
- "^docs"
- "^test"
- "^chore"
- "^ci"
brews:
- name: wowforge-cli
repository:
owner: m-triassi
name: homebrew-public
homepage: "https://github.com/m-triassi/wowforge-cli"
description: "Easily add and update addons for your World of Warcraft installation"
license: "MIT"
nfpms:
- package_name: wowforge-cli
file_name_template: "{{ .ConventionalFileName }}"
vendor: m-triassi
homepage: https://github.com/m-triassi/wowforge-cli
description: |-
Easily add and update addons for your World of Warcraft installation
license: MIT
maintainer: Massimo Triassi <[email protected]>
formats:
- deb
- apk
- rpm
- archlinux
dependencies:
- git
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changelog

All notable changes to `wowforge-cli` will be documented in this file.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Simple Makefile for a Go project

# Build the application
all: build

setup:
@go mod download

build:
@echo "Building..."
@go build -o bin/wowforge-cli main.go
@go build -o dist/wowforge-cli main.go

# Run the application
run:
Expand All @@ -19,6 +20,6 @@ test:
# Clean the binary
clean:
@echo "Cleaning..."
@rm -f bin/wowforge-cli
@rm -f dist/*

.PHONY: all build run test clean
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/m-triassi/wowforge-cli

go 1.21.3
go 1.21

require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
Expand Down

0 comments on commit 2f91097

Please sign in to comment.