Skip to content

Commit 530d789

Browse files
authored
Update and rename nightly-build.yml to build.yml (pytorch#240)
* Update and rename nightly-build.yml to build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml * Update build.yml
1 parent b945af7 commit 530d789

File tree

2 files changed

+59
-31
lines changed

2 files changed

+59
-31
lines changed

.github/workflows/build.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: PyPI Nightly Build
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *' # Runs at midnight UTC every day
6+
workflow_dispatch:
7+
inputs:
8+
build-type:
9+
description: 'Choose build type: nightly or release'
10+
required: true
11+
default: 'release'
12+
options:
13+
- nightly
14+
- release
15+
ref:
16+
description: 'Branch or tag name'
17+
required: false
18+
default: 'main'
19+
20+
jobs:
21+
build-and-publish:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v3
25+
with:
26+
ref: ${{ github.event.inputs.ref }}
27+
- name: Set up Python
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: '3.x'
31+
- name: Install dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
pip install setuptools wheel twine
35+
pip install -r requirements.txt
36+
- name: Build package
37+
run: |
38+
if [ "${{ github.event_name }}" = "schedule" ]; then
39+
export TORCHAO_NIGHTLY=1
40+
elif [ "${{ github.event.inputs['build-type'] }}" = "nightly" ]; then
41+
export TORCHAO_NIGHTLY=1
42+
fi
43+
pip install .
44+
- name: Publish package to PyPI
45+
uses: pypa/gh-action-pypi-publish@release/v1
46+
with:
47+
user: __token__
48+
password: ${{ secrets.PYPI_API_TOKEN }}
49+
repository_url: https://upload.pypi.org/legacy/
50+
packages_dir: dist/
51+
52+
- name: Open issue on failure
53+
if: ${{ failure() && github.event_name == 'schedule' }}
54+
uses: dacbd/create-issue-action@v1
55+
with:
56+
token: ${{ secrets.GITHUB_TOKEN }}
57+
title: Nightly Build failed
58+
body: Commit ${{ github.sha }} daily scheduled [CI run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) failed, please check why
59+
assignees: ''

.github/workflows/nightly-build.yml

-31
This file was deleted.

0 commit comments

Comments
 (0)