Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .config/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com

# The lines below are called `modelines`. See `:help modeline`
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 2

before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy

builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
main: ./cmd/qmlimportsort
binary: qmlimportsort

archives:
- formats: [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
formats: [zip]

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"

release:
footer: >-

---

Released by [GoReleaser](https://github.com/goreleaser/goreleaser).
61 changes: 11 additions & 50 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ name: CI

on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
branches:
- '**'
tags:
- 'v*'

jobs:
test:
Expand Down Expand Up @@ -44,59 +44,20 @@ jobs:
contents: write

steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24'

- name: Get version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Build Linux AMD64
run: |
GOOS=linux GOARCH=amd64 go build -o qmlimportsort ./cmd/qmlimportsort
zip qmlimportsort-${{ steps.version.outputs.VERSION }}-linux-amd64.zip qmlimportsort
rm qmlimportsort

- name: Build Linux ARM64
run: |
GOOS=linux GOARCH=arm64 go build -o qmlimportsort ./cmd/qmlimportsort
zip qmlimportsort-${{ steps.version.outputs.VERSION }}-linux-arm64.zip qmlimportsort
rm qmlimportsort

- name: Build macOS AMD64
run: |
GOOS=darwin GOARCH=amd64 go build -o qmlimportsort ./cmd/qmlimportsort
zip qmlimportsort-${{ steps.version.outputs.VERSION }}-darwin-amd64.zip qmlimportsort
rm qmlimportsort

- name: Build macOS ARM64
run: |
GOOS=darwin GOARCH=arm64 go build -o qmlimportsort ./cmd/qmlimportsort
zip qmlimportsort-${{ steps.version.outputs.VERSION }}-darwin-arm64.zip qmlimportsort
rm qmlimportsort

- name: Build Windows AMD64
run: |
GOOS=windows GOARCH=amd64 go build -o qmlimportsort.exe .
zip qmlimportsort-${{ steps.version.outputs.VERSION }}-windows-amd64.zip qmlimportsort.exe
rm qmlimportsort.exe

- name: Create Release
uses: softprops/action-gh-release@v2
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
files: |
qmlimportsort-${{ steps.version.outputs.VERSION }}-linux-amd64.zip
qmlimportsort-${{ steps.version.outputs.VERSION }}-linux-arm64.zip
qmlimportsort-${{ steps.version.outputs.VERSION }}-darwin-amd64.zip
qmlimportsort-${{ steps.version.outputs.VERSION }}-darwin-arm64.zip
qmlimportsort-${{ steps.version.outputs.VERSION }}-windows-amd64.zip
draft: true
prerelease: false
generate_release_notes: true
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,7 @@ tags

# End of https://www.toptal.com/developers/gitignore/api/goland+all,vim,intellij+all,visualstudiocode

# Added by goreleaser init:
dist/

qmlimportsort
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ repos:
hooks:
- id: yamlfmt
name: "format yml"
exclude: ^.config/
args:
- "-formatter"
- "line_ending=lf"
Expand Down