-
Notifications
You must be signed in to change notification settings - Fork 1.1k
64 lines (54 loc) · 2.37 KB
/
upload-python-package.yml
File metadata and controls
64 lines (54 loc) · 2.37 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
# ====================================================================================
# Purpose:
# This workflow builds and uploads the job-builder-util-transforms Python package to Google Cloud Storage (GCS).
# It is designed to distribute the utility transforms package for use in Dataflow jobs.
# The workflow:
# 1. Sets up Python and installs build dependencies.
# 2. Builds the Python package (wheel and sdist).
# 3. Uploads the built artifacts to a specified GCS bucket.
#
# How to Run:
# This workflow is triggered manually via GitHub Actions `workflow_dispatch`.
# Required Inputs:
# - bucket_path: The GCS bucket destination (e.g., gs://my-bucket/path).
# ====================================================================================
name: Build and Upload Python Package for Job Builder
on:
workflow_dispatch:
inputs:
bucket_path:
description: 'GCS bucket path (e.g., gs://my-bucket/path)'
required: true
version:
description: 'Version number for the package (e.g., 0.1.0)'
required: true
jobs:
build-and-upload:
runs-on: [self-hosted, release]
steps:
- name: Checkout Code
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Install project dependencies
working-directory: python/src/main/python/job-builder-util-transforms
run: poetry install
- name: Run Tests
working-directory: python/src/main/python/job-builder-util-transforms
run: poetry run pytest ../../../test/python/job-builder-util-transforms/
- name: Build Package
working-directory: python/src/main/python/job-builder-util-transforms
run: poetry build
- name: Upload to GCS
env:
BUCKET_PATH: ${{ github.event.inputs.bucket_path }}
VERSION: ${{ github.event.inputs.version }}
run: |
DATE=$(date +'%Y-%m-%d')
gcloud storage cp python/src/main/python/job-builder-util-transforms/dist/job_builder_util_transforms-*.tar.gz "$BUCKET_PATH/$DATE/job_builder_util_transforms-$VERSION.tar.gz"