forked from NVIDIA/cuda-python
-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (75 loc) · 2.83 KB
/
release-upload.yml
File metadata and controls
86 lines (75 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
name: "CI: Upload git archive"
on:
workflow_call:
inputs:
git-tag:
type: string
required: true
run-id:
description: "The GHA run ID that generated validated artifacts"
type: string
required: true
component:
description: "Component to download wheels for"
type: string
required: true
concurrency:
# Concurrency group that uses the workflow name and PR number if available
# or commit SHA as a fallback. If a new build is triggered under that
# concurrency group while a previous build is running it will be canceled.
# Repeated pushes to a PR will cancel all previous builds, while multiple
# merges to main will not cancel.
group: ${{ github.workflow }}-${{ github.ref_name || github.sha }}
cancel-in-progress: true
permissions:
contents: write
jobs:
# create source archive and upload it to the published release
# URL to the archive: https://github.com/NVIDIA/<repo>/releases/download/<tag>/<repo>-<tag>.tar.gz
upload:
if: ${{ !github.event.repository.fork }}
runs-on: ubuntu-latest
env:
ARCHIVE_NAME: ${{ github.event.repository.name }}-${{ inputs.git-tag }}
steps:
- name: Checkout Source
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
ref: ${{ inputs.git-tag }}
- name: Create Release Directory
run: mkdir -p release
- name: Archive Source
run: >
git archive
--format=tar.gz
--prefix="${{ env.ARCHIVE_NAME }}/"
--output="release/${{ env.ARCHIVE_NAME }}.tar.gz"
${{ inputs.git-tag }}
- name: Compute Checksum
run: >
sha256sum "release/${{ env.ARCHIVE_NAME }}.tar.gz"
| awk '{print $1}'
> "release/${{ env.ARCHIVE_NAME }}.tar.gz.sha256sum"
- name: Upload Archive
env:
GH_TOKEN: ${{ github.token }}
run: >
gh release upload
--clobber "${{ inputs.git-tag }}"
--repo "${{ github.repository }}"
release/*
- name: Download and Upload Wheels
env:
GH_TOKEN: ${{ github.token }}
run: |
# Use the shared script to download wheels
./ci/tools/download-wheels "${{ inputs.run-id }}" "${{ inputs.component }}" "${{ github.repository }}" "release/wheels"
# Upload wheels to the release
if [[ -d "release/wheels" && $(ls -A release/wheels 2>/dev/null | wc -l) -gt 0 ]]; then
echo "Uploading wheels to release ${{ inputs.git-tag }}"
gh release upload --clobber "${{ inputs.git-tag }}" --repo "${{ github.repository }}" release/wheels/*
fi