Skip to content

Commit 6cf99e2

Browse files
ci: release master builds and upload them to the cloud (#1298)
1 parent 7eb2fb1 commit 6cf99e2

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.github/workflows/ci-reusable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727
name: ${{ matrix.os }}-${{ matrix.tests }}-${{ matrix.cpu }}-${{ matrix.nim_version }}-${{ matrix.job_number }}
2828
runs-on: ${{ matrix.builder }}
29-
timeout-minutes: 60
29+
timeout-minutes: 90
3030
steps:
3131
- name: Checkout sources
3232
uses: actions/checkout@v4

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
tags:
66
- 'v*.*.*'
7+
branches:
8+
- master
79
workflow_dispatch:
810

911
env:
@@ -170,6 +172,33 @@ jobs:
170172
path: /tmp/release/
171173
retention-days: 30
172174

175+
- name: Release - Upload to the cloud
176+
env:
177+
s3_endpoint: ${{ secrets.S3_ENDPOINT }}
178+
s3_bucket: ${{ secrets.S3_BUCKET }}
179+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
180+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
181+
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
182+
run: |
183+
# Variables
184+
branch="${GITHUB_REF_NAME/\//-}"
185+
folder="/tmp/release"
186+
187+
# Tagged releases
188+
if [[ "${{ github.ref }}" == *"refs/tags/"* ]]; then
189+
aws s3 cp --recursive "${folder}" s3://${{ env.s3_bucket }}/releases/${branch} --endpoint-url ${{ env.s3_endpoint }}
190+
echo "${branch}" > "${folder}"/latest
191+
aws s3 cp "${folder}"/latest s3://${{ env.s3_bucket }}/releases/latest --endpoint-url ${{ env.s3_endpoint }}
192+
193+
# master branch
194+
elif [[ "${branch}" == "${{ github.event.repository.default_branch }}" ]]; then
195+
aws s3 cp --recursive "${folder}" s3://${{ env.s3_bucket }}/${branch} --endpoint-url ${{ env.s3_endpoint }}
196+
197+
# Custom branch
198+
else
199+
aws s3 cp --recursive "${folder}" s3://${{ env.s3_bucket }}/branches/${branch} --endpoint-url ${{ env.s3_endpoint }}
200+
fi
201+
173202
- name: Release
174203
uses: softprops/action-gh-release@v2
175204
if: startsWith(github.ref, 'refs/tags/')

0 commit comments

Comments
 (0)