Skip to content

Commit

Permalink
add initial implementation (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerinus committed Nov 8, 2022
1 parent 94cb032 commit fbc8610
Show file tree
Hide file tree
Showing 61 changed files with 3,354 additions and 1 deletion.
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: goreleaser

on:
push:
tags:
- v*.*.*

permissions:
contents: write

jobs:
goreleaser:
runs-on: ubuntu-22.04
steps:
-
name: Install dependencies for cross-compiling
run: |
sudo apt update
sudo apt-get --no-install-recommends --yes install \
libc6-dev-amd64-cross \
gcc-aarch64-linux-gnu libc6-dev-arm64-cross \
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Fetch all tags
run: git fetch --force --tags
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
-
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.19
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' distribution
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Upload to oss
id: upload_to_oss
uses: tvrcgo/upload-to-oss@master
with:
key-id: ${{ secrets.OSS_KEY_ID }}
key-secret: ${{ secrets.OSS_KEY_SECRET }}
region: oss-cn-shanghai
bucket: casaos
assets: |
dist/checksums.txt:/IceWhaleTech/CasaOS/releases/download/${{ steps.get_version.outputs.VERSION }}/checksums.txt
dist/linux-arm-7-casaos-message-bus-${{ steps.get_version.outputs.VERSION }}.tar.gz:/IceWhaleTech/CasaOS-MessageBus/releases/download/${{ steps.get_version.outputs.VERSION }}/linux-arm-7-casaos-message-bus-${{ steps.get_version.outputs.VERSION }}.tar.gz
dist/linux-arm64-casaos-message-bus-${{ steps.get_version.outputs.VERSION }}.tar.gz:/IceWhaleTech/CasaOS-MessageBus/releases/download/${{ steps.get_version.outputs.VERSION }}/linux-arm64-casaos-message-bus-${{ steps.get_version.outputs.VERSION }}.tar.gz
dist/linux-amd64-casaos-message-bus-${{ steps.get_version.outputs.VERSION }}.tar.gz:/IceWhaleTech/CasaOS-MessageBus/releases/download/${{ steps.get_version.outputs.VERSION }}/linux-amd64-casaos-message-bus-${{ steps.get_version.outputs.VERSION }}.tar.gz
dist/linux-arm-7-casaos-message-bus-migration-tool-${{ steps.get_version.outputs.VERSION }}.tar.gz:/IceWhaleTech/CasaOS-MessageBus/releases/download/${{ steps.get_version.outputs.VERSION }}/linux-arm-7-casaos-message-bus-migration-tool-${{ steps.get_version.outputs.VERSION }}.tar.gz
dist/linux-arm64-casaos-message-bus-migration-tool-${{ steps.get_version.outputs.VERSION }}.tar.gz:/IceWhaleTech/CasaOS-MessageBus/releases/download/${{ steps.get_version.outputs.VERSION }}/linux-arm64-casaos-message-bus-migration-tool-${{ steps.get_version.outputs.VERSION }}.tar.gz
dist/linux-amd64-casaos-message-bus-migration-tool-${{ steps.get_version.outputs.VERSION }}.tar.gz:/IceWhaleTech/CasaOS-MessageBus/releases/download/${{ steps.get_version.outputs.VERSION }}/linux-amd64-casaos-message-bus-migration-tool-${{ steps.get_version.outputs.VERSION }}.tar.gz
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,9 @@

# Dependency directories (remove the comment below to include it)
# vendor/

.vscode/
dist/
target/
codegen/
__debug_bin
151 changes: 151 additions & 0 deletions .goreleaser.debug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
project_name: casaos-message-bus
before:
hooks:
- go generate
- go mod tidy
- go test -v ./...
builds:
- id: casaos-message-bus-amd64
binary: build/sysroot/usr/bin/casaos-message-bus
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- amd64
- id: casaos-message-bus-arm64
binary: build/sysroot/usr/bin/casaos-message-bus
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm64
- id: casaos-message-bus-arm-7
binary: build/sysroot/usr/bin/casaos-message-bus
env:
- CGO_ENABLED=1
- CC=arm-linux-gnueabihf-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm
goarm:
- "7"
- id: casaos-message-bus-migration-tool-amd64
binary: build/sysroot/usr/bin/casaos-message-bus-migration-tool
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- amd64
- id: casaos-message-bus-migration-tool-arm64
binary: build/sysroot/usr/bin/casaos-message-bus-migration-tool
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm64
- id: casaos-message-bus-migration-tool-arm-7
binary: build/sysroot/usr/bin/casaos-message-bus-migration-tool
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=arm-linux-gnueabihf-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm
goarm:
- "7"
archives:
- name_template: "{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-v{{ .Version }}"
id: casaos-message-bus
builds:
- casaos-message-bus-amd64
- casaos-message-bus-arm64
- casaos-message-bus-arm-7
replacements:
arm: arm-7
files:
- build/**/*
- name_template: "{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-migration-tool-v{{ .Version }}"
id: casaos-message-bus-migration-tool
builds:
- casaos-message-bus-migration-tool-amd64
- casaos-message-bus-migration-tool-arm64
- casaos-message-bus-migration-tool-arm-7
replacements:
arm: arm-7
files:
- build/sysroot/etc/**/*
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-snapshot"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
release:
github:
owner: IceWhaleTech
name: CasaOS-MessageBus
draft: true
prerelease: auto
mode: replace
name_template: "v{{ .Version }}"
151 changes: 151 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
project_name: casaos-message-bus
before:
hooks:
- go generate
- go mod tidy
- go test -v ./...
builds:
- id: casaos-message-bus-amd64
binary: build/sysroot/usr/bin/casaos-message-bus
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- amd64
- id: casaos-message-bus-arm64
binary: build/sysroot/usr/bin/casaos-message-bus
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm64
- id: casaos-message-bus-arm-7
binary: build/sysroot/usr/bin/casaos-message-bus
env:
- CGO_ENABLED=1
- CC=arm-linux-gnueabihf-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm
goarm:
- "7"
- id: casaos-message-bus-migration-tool-amd64
binary: build/sysroot/usr/bin/casaos-message-bus-migration-tool
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- amd64
- id: casaos-message-bus-migration-tool-arm64
binary: build/sysroot/usr/bin/casaos-message-bus-migration-tool
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm64
- id: casaos-message-bus-migration-tool-arm-7
binary: build/sysroot/usr/bin/casaos-message-bus-migration-tool
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=arm-linux-gnueabihf-gcc
ldflags:
- -s
- -w
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm
goarm:
- "7"
archives:
- name_template: "{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-v{{ .Version }}"
id: casaos-message-bus
builds:
- casaos-message-bus-amd64
- casaos-message-bus-arm64
- casaos-message-bus-arm-7
replacements:
arm: arm-7
files:
- build/**/*
- name_template: "{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-migration-tool-v{{ .Version }}"
id: casaos-message-bus-migration-tool
builds:
- casaos-message-bus-migration-tool-amd64
- casaos-message-bus-migration-tool-arm64
- casaos-message-bus-migration-tool-arm-7
replacements:
arm: arm-7
files:
- build/sysroot/etc/**/*
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-snapshot"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
release:
github:
owner: IceWhaleTech
name: CasaOS-MessageBus
draft: true
prerelease: auto
mode: replace
name_template: "v{{ .Version }}"
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
# CasaOS-MessageBus
Message bus accepts events and actions from various sources and delivers them to subscribers

[![Go Reference](https://pkg.go.dev/badge/github.com/IceWhaleTech/CasaOS-MessageBus.svg)](https://pkg.go.dev/github.com/IceWhaleTech/CasaOS-MessageBus) [![Go Report Card](https://goreportcard.com/badge/github.com/IceWhaleTech/CasaOS-MessageBus)](https://goreportcard.com/report/github.com/IceWhaleTech/CasaOS-MessageBus) [![goreleaser](https://github.com/IceWhaleTech/CasaOS-MessageBus/actions/workflows/release.yml/badge.svg)](https://github.com/IceWhaleTech/CasaOS-MessageBus/actions/workflows/release.yml)

Message bus accepts events and actions from various sources and delivers them to subscribers.

See [openapi.yaml](./api/message_bus/openapi.yaml) for API specification.

0 comments on commit fbc8610

Please sign in to comment.