|
1 | 1 | name: Release
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - # push: |
5 |
| - # tags: |
6 |
| - # - 'v*' |
7 | 4 | workflow_dispatch:
|
| 5 | + inputs: |
| 6 | + release_tag: |
| 7 | + description: "The desired tag for the release (e.g. v0.1.0)." |
| 8 | + required: true |
8 | 9 |
|
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 |
13 | 12 |
|
14 | 13 | jobs:
|
15 |
| - build-binary: |
16 |
| - name: Build binary |
| 14 | + release: |
17 | 15 | runs-on: ubuntu-latest
|
18 |
| - container: |
19 |
| - image: golang:1.24rc2-bullseye@sha256:236da40764c1bcf469fcaf6ca225ca881c3f06cbd1934e392d6e4af3484f6cac |
| 16 | + env: |
| 17 | + VERSION: ${{ github.event.inputs.release_tag }} |
20 | 18 | steps:
|
21 |
| - - name: Checkout sources |
| 19 | + - name: Check out repository code |
22 | 20 | uses: actions/checkout@v4
|
23 | 21 | with:
|
24 | 22 | fetch-depth: 0
|
| 23 | + ref: ${{ github.event.inputs.release_tag }} |
25 | 24 |
|
26 |
| - - name: Build binaries |
27 |
| - run: make build |
28 |
| - |
29 |
| - - name: Upload artifacts |
30 |
| - |
| 25 | + - name: 🐿 Setup Golang |
| 26 | + uses: actions/setup-go@v6 |
31 | 27 | 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 |
40 | 30 |
|
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 |
46 | 33 |
|
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 |
63 | 36 |
|
64 |
| - - name: Build and Push with Kaniko |
| 37 | + - name: Rename and archive binaries |
65 | 38 | 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 |
67 | 42 |
|
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 |
69 | 46 |
|
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 |
81 | 50 |
|
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 |
88 | 53 |
|
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 |
94 | 56 | 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