Skip to content

Commit 8d23881

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

File tree

1 file changed

+119
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)