-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (64 loc) · 2.61 KB
/
_build_package.yml
File metadata and controls
66 lines (64 loc) · 2.61 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
---
# ─────────────────────────────────────────────────────────────────────────────
# _build_package.yml
#
# Compiles or packages the project. This workflow handles only the build step.
# It returns the directory where the build artifacts are located, allowing
# calling workflows to handle uploading, publishing, or further processing.
#
# Inputs:
# build_type (required): "release", "post", "nightly", or "dev"
#
# Outputs:
# build_location — Path to the directory containing the build output
# build_metadata — Any important metadata about the build (e.g., version, sha256)
#
# Callers: development.yml, nightly.yml, release.yml
# ─────────────────────────────────────────────────────────────────────────────
name: "Build Package (Reusable)"
on:
workflow_call:
inputs:
build_type:
description: "Type of build: release, post, nightly, or dev"
required: true
type: string
outputs:
build_location:
description: "Directory path containing the built artifacts"
value: ${{ jobs.build-package.outputs.location }}
build_metadata:
description: "Metadata regarding the build (e.g. SHA256)"
value: ${{ jobs.build-package.outputs.metadata }}
permissions:
contents: read
jobs:
build-package:
name: "Build Package (${{ inputs.build_type }})"
runs-on: ubuntu-latest
outputs:
location: ${{ steps.build.outputs.location }}
metadata: ${{ steps.build.outputs.metadata }}
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: "Set up build toolchain"
uses: pypa/hatch@install
- name: "Build package"
id: build
run: |
hatch build
# Output the location
echo "location=dist/" >> "$GITHUB_OUTPUT"
# Compute SHA256 or other metadata
SHA=$(find dist/ -type f | sort | xargs sha256sum | sha256sum | awk '{print $1}')
echo "metadata=${SHA}" >> "$GITHUB_OUTPUT"
- name: Upload build artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: build-artifact-${{ inputs.build_type }}-${{ github.run_id }}
path: dist/
retention-days: 7
if-no-files-found: warn