Skip to content

Commit 4d760e4

Browse files
committed
added binaries to release workflow
1 parent 6e4598a commit 4d760e4

2 files changed

Lines changed: 138 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: CI
33
on:
44
push:
55
workflow_dispatch:
6+
workflow_call:
67

78
jobs:
89
build_and_test_ubuntu:
@@ -76,6 +77,7 @@ jobs:
7677
path: build/src/mgconsole
7778

7879
build_and_test_static:
80+
if: ${{ github.event_name == 'workflow_call' }}
7981
strategy:
8082
fail-fast: false
8183
matrix:

.github/workflows/release.yml

Lines changed: 136 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,22 @@ on:
1212
type: boolean
1313
required: false
1414
default: false
15+
test-release:
16+
description: "Test the release by pushing to test repository"
17+
type: boolean
18+
required: false
19+
default: true
20+
21+
env:
22+
S3_BUCKET: "${{ github.event.inputs.test-release == 'true' && 'deps.memgraph.io' || 'download.memgraph.com' }}"
23+
S3_BASE_PREFIX: "${{ github.event.inputs.test-release == 'true' && 'mgconsole-test' || 'mgconsole' }}/v${{ github.event.inputs.version }}"
1524

1625
jobs:
1726
build-and-push:
1827
runs-on: ubuntu-latest
1928
env:
2029
DOCKER_ORGANIZATION_NAME: memgraph
21-
DOCKER_REPOSITORY_NAME: mgconsole
30+
DOCKER_REPOSITORY_NAME: "${{ github.event.inputs.test-release == 'true' && 'mgconsole-test' || 'mgconsole' }}"
2231

2332
steps:
2433
- name: Checkout repository
@@ -62,4 +71,129 @@ jobs:
6271

6372
- name: Verify Docker image
6473
run: |
65-
docker run --rm $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ github.event.inputs.version }} --version
74+
docker run --rm $DOCKER_ORGANIZATION_NAME/$DOCKER_REPOSITORY_NAME:${{ github.event.inputs.version }} --version
75+
76+
build-binaries:
77+
name: Build binaries
78+
uses: ./.github/workflows/ci.yml
79+
80+
upload-binaries:
81+
name: Upload binaries
82+
needs: [build-binaries, build-and-push]
83+
runs-on: ubuntu-latest
84+
steps:
85+
- name: Checkout repository
86+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
87+
88+
89+
- name: Login to AWS
90+
uses: aws-actions/configure-aws-credentials@f7b8181755fc1413cd909cbac860d8a76dc848f1 # v6.0.2
91+
with:
92+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
93+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
94+
aws-region: eu-west-1
95+
96+
- name: Download artifacts Linux X64
97+
uses: actions/download-artifact@v4
98+
with:
99+
name: "mgconsole static Linux build X64"
100+
path: linux-x86_64/mgconsole
101+
102+
- name: Download artifacts Linux ARM64
103+
uses: actions/download-artifact@v4
104+
with:
105+
name: "mgconsole static Linux build ARM64"
106+
path: linux-aarch64/mgconsole
107+
108+
- name: Download artifacts MacOS
109+
uses: actions/download-artifact@v4
110+
with:
111+
name: "mgconsole MacOS build"
112+
path: macos/mgconsole
113+
114+
- name: Download artifacts Windows
115+
uses: actions/download-artifact@v4
116+
with:
117+
name: "mgconsole Windows build"
118+
path: windows/mgconsole.exe
119+
120+
- name: Upload binaries to S3
121+
env:
122+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
123+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
124+
run: |
125+
aws s3 cp linux-x86_64/mgconsole s3://${{ env.S3_BUCKET }}/${{ env.S3_BASE_PREFIX }}/linux-x86_64/mgconsole
126+
aws s3 cp linux-aarch64/mgconsole s3://${{ env.S3_BUCKET }}/${{ env.S3_BASE_PREFIX }}/linux-aarch64/mgconsole
127+
aws s3 cp macos/mgconsole s3://${{ env.S3_BUCKET }}/${{ env.S3_BASE_PREFIX }}/macos/mgconsole
128+
aws s3 cp windows/mgconsole.exe s3://${{ env.S3_BUCKET }}/${{ env.S3_BASE_PREFIX }}/windows/mgconsole.exe
129+
130+
- name: Configure Git
131+
run: |
132+
git config user.name "github-actions"
133+
git config user.email "github-actions@github.com"
134+
135+
- name: Set tag
136+
if: ${{ github.event.inputs.test-release == 'false' }}
137+
run: |
138+
TAG="v${{ github.event.inputs.version }}"
139+
echo "TAG=${TAG}" >> $GITHUB_ENV
140+
git tag $TAG
141+
git push origin $TAG
142+
143+
- name: Create GitHub Release
144+
id: create_release
145+
uses: actions/create-release@0cb9c9b65d5d1901c1f53e5e66eaf4afd303e70e # v1.1.4
146+
env:
147+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148+
with:
149+
tag_name: ${{ env.TAG }}
150+
release_name: "Release ${{ env.TAG }}"
151+
draft: true
152+
prerelease: false
153+
154+
- name: Compress binaries
155+
run: |
156+
tar -czvf mgconsole-${{ env.TAG }}-linux-x86_64.tar.gz linux-x86_64/mgconsole
157+
tar -czvf mgconsole-${{ env.TAG }}-linux-aarch64.tar.gz linux-aarch64/mgconsole
158+
tar -czvf mgconsole-${{ env.TAG }}-macos.tar.gz macos/mgconsole
159+
tar -czvf mgconsole-${{ env.TAG }}-windows.tar.gz windows/mgconsole.exe
160+
161+
- name: Upload binaries to Release Linux X64
162+
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
163+
env:
164+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
165+
with:
166+
upload_url: ${{ steps.create_release.outputs.upload_url }}
167+
asset_path: ./mgconsole-${{ env.TAG }}-linux-x86_64.tar.gz
168+
asset_name: mgconsole-${{ env.TAG }}-linux-x86_64.tar.gz
169+
asset_content_type: application/octet-stream
170+
171+
- name: Upload binaries to Release Linux ARM64
172+
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
173+
env:
174+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
175+
with:
176+
upload_url: ${{ steps.create_release.outputs.upload_url }}
177+
asset_path: ./mgconsole-${{ env.TAG }}-linux-aarch64.tar.gz
178+
asset_name: mgconsole-${{ env.TAG }}-linux-aarch64.tar.gz
179+
asset_content_type: application/octet-stream
180+
181+
- name: Upload binaries to Release MacOS
182+
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
183+
env:
184+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185+
with:
186+
upload_url: ${{ steps.create_release.outputs.upload_url }}
187+
asset_path: ./mgconsole-${{ env.TAG }}-macos.tar.gz
188+
asset_name: mgconsole-${{ env.TAG }}-macos.tar.gz
189+
asset_content_type: application/octet-stream
190+
191+
- name: Upload binaries to Release Windows
192+
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # v1.0.2
193+
env:
194+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195+
with:
196+
upload_url: ${{ steps.create_release.outputs.upload_url }}
197+
asset_path: ./mgconsole-${{ env.TAG }}-windows.tar.gz
198+
asset_name: mgconsole-${{ env.TAG }}-windows.tar.gz
199+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)