From 6cd013e81cf814e0f4356dc85050fd40cef8b38a Mon Sep 17 00:00:00 2001 From: Yota Hamada Date: Tue, 11 Feb 2025 03:48:51 -0800 Subject: [PATCH] [#821] Support Snapcraft distribution (#824) --- .github/workflows/release.yaml | 3 ++ .goreleaser.yaml | 58 ++++++++++++++++++++++++------- Makefile | 2 +- internal/digraph/executor/mail.go | 2 +- 4 files changed, 50 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1cfc405b0..3b982ba92 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -39,6 +39,9 @@ jobs: run: | cp ui/dist/* ./internal/frontend/assets/ + - name: Install Snapcraft + run: sudo snap install snapcraft --classic + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2 with: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 0eb0fe51b..dab3b0bde 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,10 +1,10 @@ +# goreleaser.yaml version: 2 -# This is an example .goreleaser.yml file with some sensible defaults. -# Make sure to check the documentation at https://goreleaser.com + before: hooks: - # You may remove this if you don't use go modules. - go mod tidy + builds: - dir: ./cmd env: @@ -12,30 +12,41 @@ builds: goos: - linux - darwin + - freebsd + - openbsd + - netbsd + # - windows goarch: - - amd64 - - arm - - arm64 + - "amd64" + - "386" + - "arm" + - "arm64" + - "ppc64le" + - "s390x" goarm: + - "6" - "7" + checksum: name_template: "checksums.txt" + snapshot: name_template: "{{ incpatch .Version }}-next" + changelog: sort: asc filters: exclude: - "^docs:" - "^test:" + brews: - # DEPRECATED: prefer using dagu-org/dagu for brew formula - repository: - owner: yohamta - name: homebrew-tap + owner: dagu-org + name: homebrew-brew directory: Formula homepage: "https://github.com/dagu-org/dagu" - description: "A No-code workflow engine that runs DAGs defined in a simple YAML format" + description: "Dagu is a compact, portable, and language-agnostic workflow engine." license: "GNU General Public License v3.0" custom_block: | service do @@ -45,12 +56,14 @@ brews: log_path var/"log/dagu.log" working_dir var end + + # Deprecated brew tap: - repository: - owner: dagu-org - name: homebrew-brew + owner: yohamta + name: homebrew-tap directory: Formula homepage: "https://github.com/dagu-org/dagu" - description: "A No-code workflow engine that runs DAGs defined in a simple YAML format" + description: "Dagu is a compact, portable, and language-agnostic workflow engine." license: "GNU General Public License v3.0" custom_block: | service do @@ -60,3 +73,22 @@ brews: log_path var/"log/dagu.log" working_dir var end + +snapcrafts: + - name: dagu + title: Dagu + summary: "A compact, portable, and language-agnostic workflow engine." + description: "Dagu is a compact, portable, and language-agnostic workflow engine." + confinement: strict + grade: stable + base: core22 + license: "GPL-3.0" + apps: + dagu: + command: dagu start-all + daemon: simple + restart_condition: "always" + plugs: + - network + - home + - personal-files diff --git a/Makefile b/Makefile index c8a7e862f..8f3d19662 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ LDFLAGS=-X 'main.version=$(BUILD_VERSION)-$(DATE)' APP_NAME=dagu # Docker image build configuration -DOCKER_CMD := docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm64/v8 --builder container --build-arg VERSION=$(VERSION) --push --no-cache +DOCKER_CMD := docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7,linux/arm64/v8 --builder container --build-arg LDFLAGS=$(LDFLAGS) --push --no-cache # Arguments for the tests GOTESTSUM_ARGS=--format=standard-quiet diff --git a/internal/digraph/executor/mail.go b/internal/digraph/executor/mail.go index e5d58577d..d26045ac8 100644 --- a/internal/digraph/executor/mail.go +++ b/internal/digraph/executor/mail.go @@ -25,7 +25,7 @@ type mailConfig struct { To string `mapstructure:"to"` Subject string `mapstructure:"subject"` Message string `mapstructure:"message"` - Attachments []string `json:"attachments,omitempty"` + Attachments []string `mapstructure:"attachments"` } func newMail(ctx context.Context, step digraph.Step) (Executor, error) {