Skip to content

Commit

Permalink
chore: configure release workflow on push tags
Browse files Browse the repository at this point in the history
  • Loading branch information
eneskaya committed Mar 16, 2023
1 parent 0fb708f commit 43e0fa3
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 36 deletions.
53 changes: 18 additions & 35 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: "Release Komiser"
on: push
on:
push:
# run only against tags
tags:
- "*"

jobs:
build_frontend:
Expand Down Expand Up @@ -29,51 +33,30 @@ jobs:
needs: build_frontend
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- run: git fetch --force --tags

- name: Set up Go
uses: actions/setup-go@v4
- uses: actions/setup-go@v4
with:
go-version: 1.20.2
go-version: ">=1.20.2"
cache: true

- name: Install go-bin-data
run: |
go install -a -v github.com/go-bindata/go-bindata/...@latest
go install -v github.com/elazarl/go-bindata-assetfs/...
- name: Install dependencies
run: go mod download

- uses: actions/download-artifact@v3
with:
name: dashboard-build
path: out

- name: Create assets
run: |
go-bindata-assetfs -o internal/api/v1/template.go out/...
sed -i -e 's/package main/package v1/g' internal/api/v1/template.go
- name: Build & Package
run: |
make build
make package
- uses: actions/upload-artifact@v3
with:
name: komiser_linux_amd64
path: bin/komiser_linux_amd64

- uses: actions/upload-artifact@v3
with:
name: bin/komiser_windows_amd64.exe
path: bin/bin/komiser_windows_amd64.exe

- uses: actions/upload-artifact@v3
with:
name: bin/komiser_darwin_amd64
path: bin/bin/komiser_darwin_amd64

- uses: actions/upload-artifact@v3
- uses: goreleaser/goreleaser-action@v4
with:
name: bin/komiser_darwin_arm64
path: bin/bin/komiser_darwin_arm64
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ bin
*.db

.vscode/
.env
.env
dist/
47 changes: 47 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
# you may remove this if you don't need go generate
- go generate ./...
- go-bindata-assetfs -o internal/api/v1/template.go out/...
- sed -i -e 's/package main/package v1/g' internal/api/v1/template.go
builds:
- env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64

archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
# The lines beneath this are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

0 comments on commit 43e0fa3

Please sign in to comment.