-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (88 loc) · 3.5 KB
/
create-new-release.yml
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
87
88
89
90
# This is a basic workflow to help you get started with Actions
name: Bump version
# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
release-tag:
description: 'Tag of release branch'
required: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
check-version-and-create-branch:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions-ecosystem/action-regex-match@v2
id: regex-match
with:
text: ${{ github.event.inputs.release-tag }}
# https://www.python.org/dev/peps/pep-0440
# [N!]N(.N)*[{a|b|rc}N][.postN][.devN]
regex: '^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$'
- name: Check branch name
if: steps.regex-match.outputs.match == ''
run: echo "Given release tag wrong, quit." && exit 1
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- uses: actions/checkout@master
- name: Update version
run: echo "__version__ = \"${{ github.event.inputs.release-tag }}\"" > vlutils/__init__.py && cd conda && python finalize.py ${{ github.event.inputs.release-tag }}
- name: Commit changes
uses: EndBug/add-and-commit@v4
with:
author_name: Xiaosu Zhu
author_email: xiaosu.zhu@outlook.com
message: "Bump version to ${{ github.event.inputs.release-tag }}"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PUSH_TO_RELEASE }}
branch: r${{ github.event.inputs.release-tag }}
test-n-build-publish:
needs: [check-version-and-create-branch]
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@master
with:
ref: r${{ github.event.inputs.release-tag }}
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Test
run: echo "Test"
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
auto-activate-base: true
activate-environment: ""
- name: Run conda build and publish 📦
run: |
conda install anaconda-client conda-build pybind11 conda-verify
conda config --set anaconda_upload yes
conda build -c conda-forge -c pytorch -c xiaosu-zhu --output-folder build conda/
- name: Make, build, package
run: make all ARGS="--branch r${{ github.event.inputs.release-tag }}"
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Release
uses: softprops/action-gh-release@v1
with:
body_path: README.md
files: dist/*
fail_on_unmatched_files: true
tag_name: r${{ github.event.inputs.release-tag }}
name: Release ${{ github.event.inputs.release-tag }}
env:
GITHUB_TOKEN: ${{ secrets.PUSH_TO_RELEASE }}