Skip to content

Commit 90d7005

Browse files
authored
Fix release CI (#56)
## 📝 Summary Current Release CI is broken. I have added a simple one to build and upload binaries. Right now it doesn't run automatically on every tag, but needs to be triggered manually. I have tested in a fork. This is a test run: https://github.com/niccoloraspa/buildernet-orderflow-proxy/actions/runs/18122690530 This is the resulting release: https://github.com/niccoloraspa/buildernet-orderflow-proxy/releases/tag/v0.0.1 I have removed the Docker building/pushing part from the release CI as it wasn't working. I can fix that in another PR if needed. ## ✅ I have run these commands * [x] `make lint` * [x] `make test` * [x] `go mod tidy`
1 parent c3bccad commit 90d7005

File tree

1 file changed

+39
-75
lines changed

1 file changed

+39
-75
lines changed

.github/workflows/release.yaml

Lines changed: 39 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,62 @@
11
name: Release
22

33
on:
4-
# push:
5-
# tags:
6-
# - 'v*'
74
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: "The desired tag for the release (e.g. v0.1.0)."
8+
required: true
89

9-
env:
10-
REGISTRY: ghcr.io
11-
IMAGE_NAME: ${{ github.repository }}
12-
KANIKO_VERSION: gcr.io/kaniko-project/executor@sha256:9e69fd4330ec887829c780f5126dd80edc663df6def362cd22e79bcdf00ac53f
10+
permissions:
11+
contents: write
1312

1413
jobs:
15-
build-binary:
16-
name: Build binary
14+
release:
1715
runs-on: ubuntu-latest
18-
container:
19-
image: golang:1.24rc2-bullseye@sha256:236da40764c1bcf469fcaf6ca225ca881c3f06cbd1934e392d6e4af3484f6cac
16+
env:
17+
VERSION: ${{ github.event.inputs.release_tag }}
2018
steps:
21-
- name: Checkout sources
19+
- name: Check out repository code
2220
uses: actions/checkout@v4
2321
with:
2422
fetch-depth: 0
23+
ref: ${{ github.event.inputs.release_tag }}
2524

26-
- name: Build binaries
27-
run: make build
28-
29-
- name: Upload artifacts
30-
uses: actions/[email protected]
25+
- name: 🐿 Setup Golang
26+
uses: actions/setup-go@v6
3127
with:
32-
path: build/
33-
34-
build-receiver-image:
35-
name: Build Receiver Docker Image
36-
runs-on: ubuntu-latest
37-
permissions:
38-
contents: read
39-
packages: write
28+
go-version-file: go.mod
29+
check-latest: true
4030

41-
steps:
42-
- name: Checkout repository
43-
uses: actions/checkout@v4
44-
with:
45-
fetch-depth: 0
31+
- name: Download dependencies
32+
run: go mod download
4633

47-
- name: Extract metadata
48-
id: meta
49-
uses: docker/metadata-action@v5
50-
with:
51-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-receiver
52-
tags: |
53-
type=sha
54-
type=semver,pattern={{version}}
55-
type=semver,pattern={{major}}.{{minor}}
56-
57-
- name: Login to GitHub Container Registry
58-
uses: docker/login-action@v3
59-
with:
60-
registry: ${{ env.REGISTRY }}
61-
username: ${{ github.actor }}
62-
password: ${{ secrets.GITHUB_TOKEN }}
34+
- name: Build binaries
35+
run: make build
6336

64-
- name: Build and Push with Kaniko
37+
- name: Rename and archive binaries
6538
run: |
66-
mkdir -p /home/runner/.docker
39+
RAW_TAG=${{ github.event.inputs.release_tag }}
40+
TAG=${RAW_TAG#v} # remove leading "v" if present
41+
cd build
6742
68-
echo '{"auths":{"${{ env.REGISTRY }}":{"auth":"'$(echo -n "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" | base64)'"}}}'> /home/runner/.docker/config.json
43+
# sender
44+
mv sender-proxy orderflow-proxy-sender-${TAG}-linux-amd64
45+
tar -czf orderflow-proxy-sender-${TAG}-linux-amd64.tar.gz orderflow-proxy-sender-${TAG}-linux-amd64
6946
70-
docker run \
71-
-v ${{ github.workspace }}:/workspace \
72-
-v /home/runner/.docker/config.json:/kaniko/.docker/config.json \
73-
${{ env.KANIKO_VERSION }} \
74-
--context /workspace \
75-
--dockerfile /workspace/receiver.dockerfile \
76-
--reproducible \
77-
--cache=true \
78-
--cache-repo ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-cache \
79-
--destination ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-receiver:${{ steps.meta.outputs.version }} \
80-
${{ steps.meta.outputs.tags }}
47+
# receiver
48+
mv receiver-proxy orderflow-proxy-receiver-${TAG}-linux-amd64
49+
tar -czf orderflow-proxy-receiver-${TAG}-linux-amd64.tar.gz orderflow-proxy-receiver-${TAG}-linux-amd64
8150
82-
github-release:
83-
runs-on: ubuntu-latest
84-
needs: [build-binary, build-receiver-image]
85-
steps:
86-
- name: Checkout sources
87-
uses: actions/checkout@v4
51+
# checksums
52+
sha256sum orderflow-proxy-* > SHA256SUMS
8853
89-
- name: Create release
90-
id: create_release
91-
uses: actions/create-release@v1
92-
env:
93-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
- name: Create GitHub Release and upload binaries
55+
uses: softprops/action-gh-release@v2
9456
with:
95-
tag_name: ${{ github.ref }}
96-
release_name: ${{ github.ref }}
97-
draft: false
98-
prerelease: false
57+
name: OrderflowProxy ${{ github.event.inputs.release_tag }}
58+
tag_name: ${{ github.event.inputs.release_tag }}
59+
files: |
60+
build/orderflow-proxy-*
61+
build/SHA256SUMS
62+
generate_release_notes: true

0 commit comments

Comments
 (0)