Skip to content

Commit aec3584

Browse files
committed
feat(cmd): build storoku command
1 parent 8ebfaf8 commit aec3584

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2620
-12
lines changed

.github/uci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Welcome to Unified CI! This file contains the configuration for your project.
2+
# You can edit it to customize the behavior of Unified CI.
3+
# For more information, see https://github.com/ipdxco/unified-github-workflows
4+
5+
# The Unified CI templates which should be distributed to your project.
6+
files: [".github/workflows/go-check.yml",".github/workflows/go-test.yml",".github/workflows/release-check.yml",".github/workflows/releaser.yml",".github/workflows/tagpush.yml"]

.github/workflows/go-check.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Go Checks
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: ["main"]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
go-check:
18+
uses: ipdxco/unified-github-workflows/.github/workflows/go-check.yml@v1.0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"skip32bit": true,
3+
"skipOSes": ["windows"]
4+
}

.github/workflows/go-test.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Go Test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: ['main']
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event_name == 'push' && github.sha || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
go-test:
18+
uses: ipdxco/unified-github-workflows/.github/workflows/go-test.yml@v1.0
19+
with:
20+
go-versions: '["this"]'
21+
secrets:
22+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/publish-ghcr.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Container
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
tags:
8+
- 'v*'
9+
workflow_run:
10+
workflows: [ Releaser ]
11+
types:
12+
- completed
13+
pull_request:
14+
15+
jobs:
16+
prepare-checkout:
17+
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
18+
name: Prepare ref
19+
runs-on: ubuntu-latest
20+
outputs:
21+
ref: ${{ github.event_name != 'workflow_run' && github.ref || steps.releaser.outputs.version }}
22+
steps:
23+
- name: Get Ref from releaser
24+
id: releaser
25+
if: github.event_name == 'workflow_run'
26+
uses: ipdxco/unified-github-workflows/.github/actions/inspect-releaser@v1.0
27+
with:
28+
artifacts-url: ${{ github.event.workflow_run.artifacts_url }}
29+
publish:
30+
name: Publish
31+
needs: [ prepare-checkout ]
32+
runs-on: ubuntu-latest
33+
permissions:
34+
contents: read
35+
packages: write
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@v3
39+
with:
40+
ref: ${{ needs.prepare-checkout.outputs.ref }}
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v2
43+
- name: Log in to the Container registry
44+
uses: docker/login-action@v2
45+
with:
46+
registry: ghcr.io
47+
username: ${{ github.actor }}
48+
password: ${{ github.token }}
49+
- name: Extract metadata
50+
id: meta
51+
uses: docker/metadata-action@v4
52+
with:
53+
images: ghcr.io/${{ github.repository }}
54+
tags: |
55+
type=semver,pattern={{raw}}
56+
type=ref,event=branch
57+
type=raw,value=${{ needs.prepare-checkout.outputs.ref }}
58+
- name: Build and push Docker image
59+
uses: docker/build-push-action@v4
60+
with:
61+
context: .
62+
cache-from: type=gha
63+
cache-to: type=gha,mode=max
64+
push: ${{ github.event_name != 'pull_request' }}
65+
tags: ${{ steps.meta.outputs.tags }}
66+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: GoReleaser
2+
on:
3+
release:
4+
types: [published]
5+
workflow_dispatch:
6+
workflow_run:
7+
workflows: [Releaser]
8+
types: [completed]
9+
jobs:
10+
bin-releaser:
11+
name: Release Binaries
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
- name: Set up Go
19+
uses: actions/setup-go@v5
20+
with:
21+
go-version: "1.23.x"
22+
- name: Release Binaries
23+
uses: goreleaser/goreleaser-action@v6
24+
with:
25+
distribution: goreleaser
26+
version: latest
27+
args: release --clean
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Release Checker
2+
3+
on:
4+
pull_request_target:
5+
paths: [ 'version.json' ]
6+
types: [ opened, synchronize, reopened, labeled, unlabeled ]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
release-check:
19+
uses: ipdxco/unified-github-workflows/.github/workflows/release-check.yml@v1.0

.github/workflows/releaser.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Releaser
2+
3+
on:
4+
push:
5+
paths: [ 'version.json' ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.sha }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
releaser:
17+
uses: ipdxco/unified-github-workflows/.github/workflows/releaser.yml@v1.0

.github/workflows/tagpush.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Tag Push Checker
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
permissions:
9+
contents: read
10+
issues: write
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
releaser:
18+
uses: ipdxco/unified-github-workflows/.github/workflows/tagpush.yml@v1.0

.goreleaser.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
builds:
2+
- main: ./cmd/storoku
3+
binary: storoku
4+
ldflags:
5+
# Sets the version variable in the build package to the build version prefixed with a 'v'
6+
# Sets the main.date to a static date for checksum verification. See https://goreleaser.com/customization/builds/#reproducible-builds.
7+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.CommitDate}} -X main.builtBy=goreleaser -X github.com/storacha/storoku/pkg/build.version=v{{.Version}}
8+
goos:
9+
- linux
10+
- windows
11+
- darwin
12+
goarch:
13+
- 'amd64'
14+
- 'arm64'
15+
# Change to a static date for checksum verification. See https://goreleaser.com/customization/builds/#reproducible-builds.
16+
mod_timestamp: '{{.CommitTimestamp}}'
17+
env:
18+
- CGO_ENABLED=0
19+
universal_binaries:
20+
- replace: true
21+
archives:
22+
- format_overrides:
23+
- goos: windows
24+
format: zip
25+
- goos: darwin
26+
format: zip
27+
name_template: >-
28+
{{ .ProjectName }}_{{ .Version }}_
29+
{{- if eq .Os "darwin" }}mac_os
30+
{{- else }}{{ .Os }}{{ end }}_{{ .Arch }}
31+
release:
32+
mode: keep-existing
33+
changelog:
34+
skip: true
35+
brews:
36+
-
37+
name: {{ .ProjectName }}
38+
39+
alternative_names:
40+
- {{ .ProjectName }}@{{ .Version }}
41+
- {{ .ProjectName }}@{{ .Major }}
42+
43+
# Git author used to commit to the repository.
44+
# Templates: allowed.
45+
commit_author:
46+
name: goreleaserbot
47+
email: bot@goreleaser.com
48+
49+
# The project name and current git tag are used in the format string.
50+
#
51+
# Templates: allowed.
52+
commit_msg_template: "Brew formula update for {{ .ProjectName }} version {{ .Tag }}"
53+
54+
# So you can `brew test` your formula.
55+
#
56+
# Template: allowed
57+
test: |
58+
system "#{bin}/storoku"
59+
60+
# Repository to push the generated files to.
61+
repository:
62+
owner: storacha
63+
name: homebrew-storoku
64+
branch: release-{{.Tag}}
65+
pull_request:
66+
enabled: true

0 commit comments

Comments
 (0)