feat: add scheduled binary release workflow

This commit is contained in:
Prad Nukala 2024-09-30 15:13:00 -04:00
parent 49e56239a5
commit d7d19f4bb7
22 changed files with 138 additions and 1716 deletions

View File

@ -1,73 +0,0 @@
name: Publish Docker Image
on:
push:
branches:
- master
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # ignore rc
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GO_VERSION: 1.22
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
jobs:
release-image:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# all lowercase ghcr registry
- run: |
DOCKER_REGISTRY=`echo "${{ env.REGISTRY }}/${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]'`
echo "DOCKER_REGISTRY=$DOCKER_REGISTRY" >> $GITHUB_ENV
REPO_NAME=`echo "${{ github.repository }}" | awk -F'/' '{print $2}' | tr '[:upper:]' '[:lower:]'`
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
- name: Parse tag
id: tag
run: |
# v0.0.1
VERSION=$(echo ${{ github.ref_name }} | sed "s/v//")
# 0.0.1
echo "VERSION=$VERSION" >> $GITHUB_ENV
# build and publish package to ghcr (public) with codebase remaining private
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT_TOKEN }}
# make sure to update package to be public in repo ghcr settings
- name: Build and push Docker image
uses: strangelove-ventures/heighliner-build-action@v1.0.0
with:
# v0.0.1
git-ref: ${{ github.ref_name }}
chain: ${{ env.REPO_NAME}}
dockerfile: cosmos
registry: ${{ env.DOCKER_REGISTRY }}
build-target: |
cd ..
make install
local: true
binaries: |
- /go/bin/sonrd
build-env: |
- BUILD_TAGS=muslc

View File

@ -1,47 +0,0 @@
name: "Release Binary"
# Pairs with .goreleaser.yaml file for configuration.
on:
push:
branches:
- master
tags:
- v*
permissions:
contents: write
jobs:
goreleaser:
if: false
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- name: Clean up dist directory
run: rm -rf dist
- name: Build
uses: goreleaser/goreleaser-action@v5
with:
version: latest
args: build --skip-validate
- name: Release
uses: goreleaser/goreleaser-action@v5
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --skip-validate --clean
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }}

62
.github/workflows/scheduled-release.yml vendored Normal file
View File

@ -0,0 +1,62 @@
name: "Release Binary"
on:
push:
branches:
- master
tags:
- v*
permissions:
contents: write
jobs:
goreleaser:
if: false
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get latest tag
run: |
# Fetch all tags
git fetch --tags
# Get the latest tag
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "Latest Tag: $LATEST_TAG"
# Checkout the latest tag
git checkout $LATEST_TAG
- name: Check if release exists
id: check_release
run: |
TAG_NAME=${{ env.latest_tag }}
echo "Checking for existing release for tag: $TAG_NAME"
RESPONSE=$(curl -s -H "Authorization: token ${{ secrets.GH_PAT_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG_NAME")
if echo "$RESPONSE" | grep -q '"id":'; then
echo "Release already exists for tag $TAG_NAME."
echo "release_exists=true" >> $GITHUB_ENV
else
echo "No release found for tag $TAG_NAME."
echo "release_exists=false" >> $GITHUB_ENV
fi
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- name: Release
if: env.release_exists == 'false'
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}

View File

@ -1,10 +1,5 @@
project_name: core version: 2
project_name: sonr
release:
github:
owner: onsonr
name: core
name_template: "{{.Tag}}"
# Only uncomment os, arch, and targets if you are NOT using cosmwasm / wasm-light-client. # Only uncomment os, arch, and targets if you are NOT using cosmwasm / wasm-light-client.
# Windows, 386 (32bit), and ARM are not Wasm compatible. # Windows, 386 (32bit), and ARM are not Wasm compatible.
@ -22,51 +17,86 @@ builds:
command: build command: build
ldflags: ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
- id: dwn
goos:
- js
goarch:
- wasm
main: ./cmd/dwn/dwn.go
binary: dwn
builder: go
gobinary: go
command: build
- id: motr
goos:
- linux
- darwin
goarch:
- amd64
- arm64
main: ./cmd/motrd
binary: motrd
builder: go
gobinary: go
command: build
ldflags:
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
archives: archives:
- id: default - id: default
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}' builds:
- core
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
format: tar.gz format: tar.gz
files: files:
- src: LICENSE*
- src: README* - src: README*
- src: CHANGELOG* - src: CHANGELOG*
- id: motr
builds:
- motr
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
format: tar.gz
files:
- src: README*
- src: CHANGELOG*
- id: dwn
builds:
- dwn
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
format: zip
files:
- src: CHANGELOG*
- src: pkl/dwn.pkl
release:
github:
owner: onsonr
name: sonr
name_template: "{{.Tag}}"
ids:
- default
- motr
- dwn
draft: false
replace_existing_draft: true
replace_existing_artifacts: true
snapshot: snapshot:
name_template: "{{ .Version }}-SNAPSHOT-{{ .ShortCommit }}" name_template: "{{ .Version }}-SNAPSHOT-{{ .ShortCommit }}"
checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"
algorithm: sha256
dist: dist
env_files:
github_token: ~/.config/goreleaser/github_token
gitlab_token: ~/.config/goreleaser/gitlab_token
gitea_token: ~/.config/goreleaser/gitea_token
source: source:
name_template: "{{ .ProjectName }}-{{ .Version }}" name_template: "{{ .ProjectName }}-{{ .Version }}"
format: tar.gz format: tar.gz
gomod:
gobinary: go
announce:
twitter:
message_template: "{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}"
mastodon:
message_template: "{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}"
server: ""
reddit:
title_template: "{{ .ProjectName }} {{ .Tag }} is out!"
url_template: "{{ .ReleaseURL }}"
discord:
message_template: "{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}"
author: GoReleaser
color: "3888754"
icon_url: https://goreleaser.com/static/avatar.png
telegram:
message_template: "{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}"
webhook:
message_template: '{ "message": "{{ .ProjectName }} {{ .Tag }} is out! Check it out at {{ .ReleaseURL }}"}'
content_type: application/json; charset=utf-8
git: git:
tag_sort: -version:refname tag_sort: -version:refname
github_urls: github_urls:
download: https://github.com download: https://github.com
gitlab_urls: gitlab_urls:
download: https://gitlab.com download: https://gitlab.com

View File

@ -94,6 +94,7 @@ endif
install: go.sum install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/sonrd go install -mod=readonly $(BUILD_FLAGS) ./cmd/sonrd
go install -mod=readonly $(BUILD_FLAGS) ./cmd/motrd
######################################## ########################################
### Tools & dependencies ### Tools & dependencies
@ -298,11 +299,11 @@ sh-testnet: mod-tidy
motr: motr:
@echo "(motr) Building motr gateway" @echo "(motr) Building motr gateway"
go build -o ./build/motr ./cmd/motr go build -o ./build/motrd ./cmd/motrd
dwn: dwn:
@echo "(dwn) Building dwn.wasm -> IPFS Vault" @echo "(dwn) Building dwn.wasm -> IPFS Vault"
GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./x/vault/client/dwn/dwn.go GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./cmd/dwn/dwn.go
templ: templ:
@echo "(templ) Generating templ files" @echo "(templ) Generating templ files"
@ -324,7 +325,7 @@ start-caddy:
start-motr: motr start-motr: motr
@echo "(start-proxy) Starting proxy server" @echo "(start-proxy) Starting proxy server"
./build/motr proxy ./build/motrd proxy
############################################################################### ###############################################################################
### help ### ### help ###

View File

@ -15,9 +15,9 @@ import (
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
promise "github.com/nlepage/go-js-promise" promise "github.com/nlepage/go-js-promise"
"github.com/onsonr/sonr/cmd/dwn/middleware"
"github.com/onsonr/sonr/cmd/dwn/state"
"github.com/onsonr/sonr/pkg/nebula/pages" "github.com/onsonr/sonr/pkg/nebula/pages"
"github.com/onsonr/sonr/x/vault/client/dwn/middleware"
"github.com/onsonr/sonr/x/vault/client/dwn/state"
) )
func main() { func main() {

View File

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,7 @@ templ SectionHero(hero Hero) {
templ heroImage() { templ heroImage() {
<!-- Image --> <!-- Image -->
<div class="max-w-5xl mx-auto px-4 sm:px-6 flex justify-center pb-12 md:pb-20 relative before:absolute before:-top-12 before:w-96 before:h-96 before:bg-zinc-900 before:opacity-[.15] before:rounded-full before:blur-3xl before:-z-10"> <div class="max-w-5xl mx-auto px-4 sm:px-6 flex justify-center pb-12 md:pb-20 relative before:absolute before:-top-12 before:w-96 before:h-96 before:bg-zinc-900 before:opacity-[.15] before:rounded-full before:blur-3xl before:-z-10 from-zinc-100 to-white">
<img <img
class="rounded-lg" class="rounded-lg"
src="https://cdn.sonr.id/img/hero-clipped.svg" src="https://cdn.sonr.id/img/hero-clipped.svg"

View File

@ -179,7 +179,7 @@ func heroImage() templ.Component {
templ_7745c5c3_Var10 = templ.NopComponent templ_7745c5c3_Var10 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!-- Image --><div class=\"max-w-5xl mx-auto px-4 sm:px-6 flex justify-center pb-12 md:pb-20 relative before:absolute before:-top-12 before:w-96 before:h-96 before:bg-zinc-900 before:opacity-[.15] before:rounded-full before:blur-3xl before:-z-10\"><img class=\"rounded-lg\" src=\"https://cdn.sonr.id/img/hero-clipped.svg\" width=\"560\" height=\"560\" alt=\"Hero\"></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<!-- Image --><div class=\"max-w-5xl mx-auto px-4 sm:px-6 flex justify-center pb-12 md:pb-20 relative before:absolute before:-top-12 before:w-96 before:h-96 before:bg-zinc-900 before:opacity-[.15] before:rounded-full before:blur-3xl before:-z-10 from-zinc-100 to-white\"><img class=\"rounded-lg\" src=\"https://cdn.sonr.id/img/hero-clipped.svg\" width=\"560\" height=\"560\" alt=\"Hero\"></div>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }