Skip to content

Commit cd6ea34

Browse files
committed
feat: add GoReleaser configuration files for multi-platform builds
1 parent 3aaac3c commit cd6ea34

File tree

5 files changed

+134
-147
lines changed

5 files changed

+134
-147
lines changed

.github/workflows/build-dev.yml

Lines changed: 8 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -6,153 +6,14 @@ on:
66
branches-ignore:
77
- main
88

9-
env:
10-
GOPRIVATE: github.com/slingdata-io/*
11-
12-
concurrency:
13-
group: ${{ github.workflow }}-${{ github.ref }}
14-
cancel-in-progress: true
15-
169
jobs:
17-
build:
18-
runs-on: [self-hosted, linux, ubuntu-16]
19-
timeout-minutes: 15
20-
21-
outputs:
22-
VERSION: ${{ steps.get_version.outputs.VERSION }}
23-
10+
trigger:
11+
runs-on: ubuntu-latest
2412
steps:
25-
- uses: actions/checkout@v2
26-
27-
- name: Set up GoLang
28-
uses: actions/setup-go@v3
29-
with:
30-
go-version: "1.24"
31-
cache: false
32-
33-
- name: Get the version
34-
id: get_version
35-
run: |
36-
VERSION="${GITHUB_REF##*/}.dev"
37-
echo "VERSION -> $VERSION"
38-
DATE=$(date +%F)
39-
VERSION=$(echo $VERSION | sed 's/^v//')
40-
echo "VERSION -> $VERSION"
41-
VERSION="$VERSION/$DATE"
42-
echo "VERSION -> $VERSION"
43-
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
44-
45-
- id: step1
46-
name: Build
47-
env:
48-
VERSION: ${{ steps.get_version.outputs.VERSION }}
49-
run: |
50-
bash scripts/build.sh
51-
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
52-
53-
release:
54-
if: "! (contains(github.event.inputs.build_only, 'true'))"
55-
needs: [build]
56-
runs-on: ${{ matrix.runner }}
57-
timeout-minutes: 25
58-
59-
strategy:
60-
fail-fast: false
61-
matrix:
62-
# runner: [self-hosted-mac, self-hosted-linux, self-hosted-windows]
63-
runner: [self-hosted-mac, ubuntu-16, windows-latest]
64-
# runner: [self-hosted-mac, ubuntu-16, self-hosted-windows]
65-
# runner: [self-hosted-mac, ubuntu-16]
66-
67-
steps:
68-
- name: Checkout
69-
uses: actions/checkout@v1
70-
with:
71-
fetch-depth: 0
72-
73-
- name: Dump context
74-
env:
75-
JOB_CONTEXT: ${{ toJson(job) }}
76-
MATRIX_CONTEXT: ${{ toJson(matrix) }}
77-
RUNNER_CONTEXT: ${{ toJson(runner) }}
78-
run: |
79-
echo "JOB_CONTEXT -> $JOB_CONTEXT"
80-
echo "MATRIX_CONTEXT -> $MATRIX_CONTEXT"
81-
echo "RUNNER_CONTEXT -> $RUNNER_CONTEXT"
82-
echo "VERSION -> ${{ needs.build.outputs.VERSION }}"
83-
84-
- name: Set up GoLang
85-
uses: actions/setup-go@v3
13+
- name: Trigger Dev Build
14+
uses: peter-evans/repository-dispatch@v2
8615
with:
87-
go-version: "1.24"
88-
cache: false
89-
90-
- name: Load Secrets
91-
uses: flarco/infisical-action@v3
92-
with:
93-
version: 0.28.1
94-
client_id: ${{ secrets.INFISICAL_CLIENT_ID }}
95-
client_secret: ${{ secrets.INFISICAL_CLIENT_SECRET }}
96-
use_system_python: true
97-
98-
- name: Build Sling (Linux)
99-
env:
100-
VERSION: ${{ needs.build.outputs.VERSION }}
101-
if: runner.os == 'linux'
102-
run: |
103-
# Prep
104-
bash scripts/ci/prep.linux.sh
105-
106-
# build
107-
bash scripts/ci/build.linux.sh $VERSION
108-
109-
- name: Build Sling (Mac)
110-
env:
111-
VERSION: ${{ needs.build.outputs.VERSION }}
112-
if: runner.os == 'macOS'
113-
run: |
114-
# Prep
115-
bash scripts/ci/prep.mac.sh
116-
117-
# build
118-
bash scripts/ci/build.mac.sh $VERSION
119-
120-
121-
- name: Configure Pagefile (Windows)
122-
if: runner.os == 'windows'
123-
uses: al-cheb/[email protected]
124-
with:
125-
minimum-size: 16GB
126-
maximum-size: 16GB
127-
disk-root: "C:"
128-
129-
- name: Build Sling (Windows)
130-
env:
131-
VERSION: ${{ needs.build.outputs.VERSION }}
132-
if: runner.os == 'windows'
133-
shell: pwsh
134-
run: |
135-
$ErrorActionPreference = "Stop"
136-
137-
# Prep
138-
.\scripts\ci\prep.win.ps1
139-
140-
# Build
141-
.\scripts\ci\build.win.ps1 $env:VERSION
142-
143-
- name: Upload to R2 (Windows)
144-
if: runner.os == 'windows'
145-
shell: pwsh
146-
run: .\mc.exe cp sling_windows_amd64.tar.gz R2/sling-public/dev/latest/
147-
148-
- name: Upload to R2 (Unix)
149-
if: runner.os != 'windows'
150-
run: mc cp *.tar.gz R2/sling-public/dev/latest/
151-
152-
- name: Purge Cache
153-
if: runner.os == 'linux'
154-
run: |
155-
curl 'https://api.cloudflare.com/client/v4/zones/c4605fd9cf8ddcd00671858bbd16ffac/purge_cache' \
156-
-H "X-Auth-Key: $CF_AUTH_KEY" \
157-
-H "X-Auth-Email: $CF_AUTH_EMAIL" \
158-
--data-raw '{"files":["https://f.slingdata.io/dev/latest/sling_linux_amd64.tar.gz","https://f.slingdata.io/dev/latest/sling_linux_arm64.tar.gz","https://f.slingdata.io/dev/latest/sling_darwin_amd64.tar.gz","https://f.slingdata.io/dev/latest/sling_darwin_arm64.tar.gz","https://f.slingdata.io/dev/latest/sling_windows_amd64.tar.gz"]}'
16+
token: ${{ secrets.REPO_ACCESS_TOKEN }}
17+
repository: slingdata-io/sling
18+
event-type: build-dev
19+
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
project_name: sling
4+
5+
before:
6+
hooks:
7+
- go mod edit -dropreplace='github.com/flarco/g' go.mod
8+
- go mod edit -dropreplace='github.com/slingdata-io/sling' go.mod
9+
- go mod edit -droprequire='github.com/slingdata-io/sling' go.mod
10+
- go mod tidy
11+
12+
builds:
13+
- main: ./cmd/sling
14+
15+
env:
16+
- CGO_ENABLED=1
17+
18+
tags:
19+
- fts5
20+
21+
goarch:
22+
- amd64
23+
24+
goos:
25+
- linux
26+
ldflags:
27+
- "-X 'github.com/slingdata-io/sling-cli/core.Version={{.Env.VERSION}}' -X 'github.com/slingdata-io/sling-cli/core/env.PlausibleURL={{.Env.PLAUSIBLE_URL}}' -X 'github.com/slingdata-io/sling-cli/core/env.SentryDsn={{.Env.SENTRY_DSN}}' -X 'github.com/slingdata-io/sling/agent.Version={{.Env.AGENT_VERSION}}'"
28+
29+
archives:
30+
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
project_name: sling
4+
5+
before:
6+
hooks:
7+
- go mod edit -dropreplace='github.com/flarco/g' go.mod
8+
- go mod edit -dropreplace='github.com/slingdata-io/sling' go.mod
9+
- go mod edit -droprequire='github.com/slingdata-io/sling' go.mod
10+
- go mod tidy
11+
12+
builds:
13+
- main: ./cmd/sling
14+
15+
env:
16+
- CGO_ENABLED=1
17+
18+
tags:
19+
- fts5
20+
21+
goarch:
22+
- arm64
23+
24+
goos:
25+
- linux
26+
ldflags:
27+
- "-X 'github.com/slingdata-io/sling-cli/core.Version={{.Env.VERSION}}' -X 'github.com/slingdata-io/sling-cli/core/env.PlausibleURL={{.Env.PLAUSIBLE_URL}}' -X 'github.com/slingdata-io/sling-cli/core/env.SentryDsn={{.Env.SENTRY_DSN}}' -X 'github.com/slingdata-io/sling/agent.Version={{.Env.AGENT_VERSION}}'"
28+
29+
archives:
30+
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'

scripts/dev/.goreleaser.mac.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
project_name: sling
4+
5+
before:
6+
hooks:
7+
- go mod edit -dropreplace='github.com/flarco/g' go.mod
8+
- go mod edit -dropreplace='github.com/slingdata-io/sling' go.mod
9+
- go mod edit -droprequire='github.com/slingdata-io/sling' go.mod
10+
- go mod tidy
11+
12+
builds:
13+
- main: ./cmd/sling
14+
15+
env:
16+
- CGO_ENABLED=1
17+
18+
tags:
19+
- fts5
20+
21+
goarch:
22+
- amd64
23+
- arm64
24+
25+
goos:
26+
- darwin
27+
28+
ldflags:
29+
- "-X 'github.com/slingdata-io/sling-cli/core.Version={{.Env.VERSION}}' -X 'github.com/slingdata-io/sling-cli/core/env.PlausibleURL={{.Env.PLAUSIBLE_URL}}' -X 'github.com/slingdata-io/sling-cli/core/env.SentryDsn={{.Env.SENTRY_DSN}}' -X 'github.com/slingdata-io/sling/agent.Version={{.Env.AGENT_VERSION}}'"
30+
31+
universal_binaries:
32+
- id: sling
33+
replace: false
34+
35+
archives:
36+
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This is an example .goreleaser.yml file with some sensible defaults.
2+
# Make sure to check the documentation at https://goreleaser.com
3+
project_name: sling
4+
5+
before:
6+
hooks:
7+
- go mod edit -dropreplace='github.com/flarco/g' go.mod
8+
- go mod edit -dropreplace='github.com/slingdata-io/sling' go.mod
9+
- go mod tidy
10+
11+
builds:
12+
- main: ./cmd/sling
13+
14+
env:
15+
- CGO_ENABLED=1
16+
17+
tags:
18+
- fts5
19+
20+
goarch:
21+
- amd64
22+
23+
goos:
24+
- windows
25+
26+
ldflags:
27+
- "-X 'github.com/slingdata-io/sling-cli/core.Version={{.Env.VERSION}}' -X 'github.com/slingdata-io/sling-cli/core/env.PlausibleURL={{.Env.PLAUSIBLE_URL}}' -X 'github.com/slingdata-io/sling-cli/core/env.SentryDsn={{.Env.SENTRY_DSN}}' -X 'github.com/slingdata-io/sling/agent.Version={{.Env.AGENT_VERSION}}'"
28+
29+
archives:
30+
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'

0 commit comments

Comments
 (0)