Skip to content

Commit c070a2a

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

File tree

1 file changed

+123
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)