Skip to content

Commit b92294f

Browse files
authored
fix: fixed broken release workflow (#1714)
1 parent 3038d93 commit b92294f

File tree

3 files changed

+64
-18
lines changed

3 files changed

+64
-18
lines changed

.github/workflows/release.yml

Lines changed: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
runs-on:
1313
group: windows-latest-large
1414
if: startsWith(github.event.head_commit.message, 'ci:') != true
15+
outputs:
16+
tag: ${{ steps.changelog.outputs.tag }}
1517
steps:
1618
- name: Setup environment
1719
run: |-
@@ -22,6 +24,7 @@ jobs:
2224
with:
2325
fetch-depth: 0
2426
- name: Conventional Commits
27+
id: changelog
2528
uses: TriPSs/conventional-changelog-action@5f00b899ccbbcbc112bd6d715d5e76e7a9e4501d # v6.1.0
2629
with:
2730
github-token: ${{ secrets.github_token }}
@@ -38,16 +41,6 @@ jobs:
3841
# on your needs.
3942
- name: Configure git for private modules
4043
run: git config --global url."https://speakeasybot:${{ secrets.BOT_REPO_TOKEN }}@github.com".insteadOf "https://github.com"
41-
- name: Set up QEMU
42-
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
43-
- name: Set up Docker Buildx
44-
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
45-
- name: Login to GitHub Container Registry
46-
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
47-
with:
48-
registry: ghcr.io
49-
username: ${{ github.actor }}
50-
password: ${{ secrets.BOT_REPO_TOKEN }}
5144
- name: Setup Choco
5245
uses: crazy-max/ghaction-chocolatey@2526f467ccbd337d307fe179959cabbeca0bc8c0 # v3.4.0
5346
with:
@@ -57,11 +50,69 @@ jobs:
5750
with:
5851
distribution: goreleaser
5952
version: latest
60-
args: release --clean
53+
args: release --clean --skip=docker
6154
env:
6255
GITHUB_TOKEN: ${{ secrets.BOT_REPO_TOKEN }}
6356
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
57+
- name: Upload dist artifacts for docker build
58+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
59+
with:
60+
name: dist
61+
path: dist/
62+
retention-days: 1
6463
- name: Trigger changelog reconcile
6564
run: gh workflow run changelog-reconcile.yml --repo speakeasy-api/marketing-site --ref main
6665
env:
6766
GH_TOKEN: ${{ secrets.BOT_REPO_TOKEN }}
67+
68+
docker:
69+
name: Build Docker Images
70+
runs-on:
71+
group: ubuntu-latest-large
72+
needs: release
73+
if: needs.release.outputs.tag != ''
74+
env:
75+
REGISTRY: ghcr.io
76+
IMAGE_NAME: speakeasy-api/speakeasy
77+
steps:
78+
- name: Checkout repository
79+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
80+
with:
81+
fetch-depth: 0
82+
- name: Download dist artifacts
83+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
84+
with:
85+
name: dist
86+
path: dist/
87+
- name: Organize binaries for Docker build
88+
run: |
89+
mkdir -p linux/amd64 linux/arm64
90+
cp dist/speakeasy_linux_amd64_v1/speakeasy linux/amd64/speakeasy
91+
cp dist/speakeasy_linux_arm64_v8.0/speakeasy linux/arm64/speakeasy
92+
chmod +x linux/amd64/speakeasy linux/arm64/speakeasy
93+
- name: Set up QEMU
94+
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
95+
- name: Set up Docker Buildx
96+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
97+
- name: Login to GitHub Container Registry
98+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
99+
with:
100+
registry: ghcr.io
101+
username: ${{ github.actor }}
102+
password: ${{ secrets.BOT_REPO_TOKEN }}
103+
- name: Extract metadata (tags, labels) for Docker
104+
id: meta
105+
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
106+
with:
107+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
108+
tags: |
109+
type=semver,pattern={{version}},value=${{ needs.release.outputs.tag }}
110+
type=raw,value=latest
111+
- name: Build and push Docker image
112+
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
113+
with:
114+
context: .
115+
platforms: linux/amd64,linux/arm64
116+
push: true
117+
tags: ${{ steps.meta.outputs.tags }}
118+
labels: ${{ steps.meta.outputs.labels }}

.goreleaser.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ builds:
1515
- linux
1616
- windows
1717
- darwin
18-
goarch:
19-
- amd64
20-
- arm64
21-
ignore:
22-
- goos: windows
23-
goarch: arm64 # Windows ARM64 can be enabled if needed
2418
ldflags:
2519
- "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser -X main.artifactArch={{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
2620
archives:

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ RUN addgroup -g 1001 speakeasy && \
6565

6666
# Copy the binary from GoReleaser build context
6767
# GoReleaser will automatically use the correct binary for the target architecture
68-
COPY speakeasy /usr/local/bin/speakeasy
68+
ARG TARGETPLATFORM
69+
COPY $TARGETPLATFORM/speakeasy /usr/local/bin/speakeasy
6970

7071
# Make the binary executable (must be done as root before switching users)
7172
RUN chmod +x /usr/local/bin/speakeasy

0 commit comments

Comments
 (0)