Skip to content

Commit 404e8bd

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

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
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+
DYNAMIC_BINARY_VERSION=$(./output/dynamic/finch-daemon --version | grep -oP '\d+\.\d+\.\d+')
77+
STATIC_BINARY_VERSION=$(./output/static/finch-daemon --version | grep -oP '\d+\.\d+\.\d+')
78+
export release_tag=${{ env.RELEASE_TAG }}
79+
export release_version=${release_tag/v/}
80+
echo $DYNAMIC_BINARY_VERSION
81+
echo $STATIC_BINARY_VERSION
82+
if ["$STATIC_BINARY_VERSION" != "$release_version"] || ["$DYNAMIC_BINARY_VERSION" != "$release_version"]; then
83+
echo "Version mismatch"
84+
exit 1
85+
fi
86+
shell: bash
87+
- uses: actions/upload-artifact@v4
88+
with:
89+
name: artifacts
90+
path: release/
91+
if-no-files-found: error
92+
outputs:
93+
release_tag: ${{ env.RELEASE_TAG }}
94+
dynamic_binary_name: ${{ env.DYNAMIC_BINARY_NAME }}
95+
static_binary_name: ${{ env.STATIC_BINARY_NAME }}
96+
validate-artifacts:
97+
needs: generate-artifacts
98+
runs-on: ubuntu-latest
99+
steps:
100+
- uses: actions/checkout@v4
101+
- uses: actions/download-artifact@v4
102+
with:
103+
name: artifacts
104+
path: release/
105+
- run: bash scripts/verify-release-artifacts.sh ${{ needs.generate-artifacts.outputs.release_tag }}
106+
# create-release:
107+
# needs: [generate-artifacts, validate-artifacts]
108+
# runs-on: ubuntu-latest
109+
# steps:
110+
# - uses: actions/checkout@v4
111+
# - uses: actions/download-artifact@v4
112+
# with:
113+
# name: artifacts
114+
# - uses: softprops/action-gh-release@v2
115+
# with:
116+
# tag_name: ${{ needs.generate-artifacts.outputs.release_tag }}
117+
# prerelease: false
118+
# generate_release_notes: false
119+
# files: |-
120+
# ${{ needs.generate-artifacts.outputs.dynamic_binary_name }}
121+
# ${{ needs.generate-artifacts.outputs.dynamic_binary_name }}.sha256sum

0 commit comments

Comments
 (0)