Skip to content

Commit 4f7f453

Browse files
committed
feat: add some data to the scripts 2
Signed-off-by: Arjun Raja Yogidas <[email protected]>
1 parent 8e68609 commit 4f7f453

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Release Finch Daemon
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
paths-ignore:
7+
- '**.md'
8+
workflow_dispatch:
9+
workflow_call:
10+
env:
11+
GO_VERSION: '1.22.7'
12+
permissions:
13+
contents: write
14+
deployments: write
15+
jobs:
16+
get-latest-tag:
17+
name: Get the latest release tag
18+
runs-on: ubuntu-latest
19+
outputs:
20+
tag: ${{ steps.latest-tag.outputs.tag }}
21+
steps:
22+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
23+
with:
24+
fetch-depth: 0
25+
- name: 'Get the latest tag'
26+
id: latest-tag
27+
uses: "WyriHaximus/github-action-get-previous-tag@04e8485ecb6487243907e330d522ff60f02283ce" # v1.4.0
28+
generate-artifacts:
29+
needs: get-latest-tag
30+
runs-on: ubuntu-latest
31+
env:
32+
# Set during setup.
33+
RELEASE_TAG: ${{ needs.get-latest-tag.outputs.tag }}
34+
DYNAMIC_BINARY_NAME: ''
35+
STATIC_BINARY_NAME: ''
36+
steps:
37+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
38+
with:
39+
fetch-tags: true
40+
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
41+
with:
42+
go-version: ${{ env.GO_VERSION }}
43+
cache: false
44+
- name: 'Echo RELEASE_TAG ENV'
45+
run: echo ${{ env.RELEASE_TAG }}
46+
- name: Setup variables and release directories
47+
run: |
48+
export release_tag=${{ env.RELEASE_TAG }}
49+
export release_version=${release_tag/v/} # Remove v from tag name
50+
echo "DYNAMIC_BINARY_NAME=finch-daemon-${release_version}-linux-amd64.tar.gz" >> $GITHUB_ENV
51+
echo "STATIC_BINARY_NAME=finch-daemon-${release_version}-linux-amd64-static.tar.gz" >> $GITHUB_ENV
52+
53+
mkdir release
54+
- name: Install Go licenses
55+
run: go install github.com/google/go-licenses@latest
56+
- name: Create Third Party Licences File
57+
run: make licenses
58+
- name: Install Dependencies for e2e Testing
59+
run: ./setup-test-env.sh
60+
# - name: setup static dependecies
61+
# run: |
62+
# sudo apt-get update
63+
# sudo apt-get install glibc-static libstdc++-static
64+
# sudo apt install libstdc++-12-dev
65+
# sudo apt-get install libc6-dev
66+
- name: Create release binaries
67+
run: make RELEASE_TAG=${{ env.RELEASE_TAG }} release
68+
- name: Verify Release version
69+
run: |
70+
mkdir -p output/static output/dynamic
71+
tar -xzf release/${{ env.DYNAMIC_BINARY_NAME }} -C ./output/dynamic
72+
tar -xzf release/${{ env.STATIC_BINARY_NAME }} -C ./output/static
73+
DYNAMIC_BINARY_VERSION=$(./output/dynamic/finch-daemon --version | grep -oP '\d+\.\d+\.\d+')
74+
STATIC_BINARY_VERSION=$(./output/static/finch-daemon --version | grep -oP '\d+\.\d+\.\d+')
75+
export release_tag=${{ env.RELEASE_TAG }}
76+
export release_version=${release_tag/v/}
77+
if ["$STATIC_BINARY_VERSION" != "$release_version"] || ["$DYNAMIC_BINARY_VERSION" != "$release_version"]; then
78+
echo "Version mismatch"
79+
exit 1
80+
fi
81+
shell: bash
82+
- uses: actions/upload-artifact@v4
83+
with:
84+
name: artifacts
85+
path: release/
86+
if-no-files-found: error
87+
outputs:
88+
release_tag: ${{ env.RELEASE_TAG }}
89+
dynamic_binary_name: ${{ env.DYNAMIC_BINARY_NAME }}
90+
static_binary_name: ${{ env.STATIC_BINARY_NAME }}
91+
validate-artifacts:
92+
needs: generate-artifacts
93+
runs-on: ubuntu-latest
94+
steps:
95+
- uses: actions/checkout@v4
96+
- uses: actions/download-artifact@v4
97+
with:
98+
name: artifacts
99+
path: release/
100+
- run: bash scripts/verify-release-artifacts.sh ${{ needs.generate-artifacts.outputs.release_tag }}
101+
# create-release:
102+
# needs: [generate-artifacts, validate-artifacts]
103+
# runs-on: ubuntu-latest
104+
# steps:
105+
# - uses: actions/checkout@v4
106+
# - uses: actions/download-artifact@v4
107+
# with:
108+
# name: artifacts
109+
# - uses: softprops/action-gh-release@v2
110+
# with:
111+
# tag_name: ${{ needs.generate-artifacts.outputs.release_tag }}
112+
# prerelease: false
113+
# generate_release_notes: false
114+
# files: |-
115+
# ${{ needs.generate-artifacts.outputs.dynamic_binary_name }}
116+
# ${{ needs.generate-artifacts.outputs.dynamic_binary_name }}.sha256sum

0 commit comments

Comments
 (0)