-
Notifications
You must be signed in to change notification settings - Fork 4
60 lines (54 loc) · 1.62 KB
/
Copy pathrelease.yaml
File metadata and controls
60 lines (54 loc) · 1.62 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
name: Release
on:
push:
branches:
- workflow_release
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- name: Get the branch and tag
id: info
run: |
branch="${GITHUB_REF#refs/heads/}"
echo "$branch"
if [[ "$branch" == "workflow_release" ]]; then
echo "::set-output name=version::TEST-0.0.0"
echo "::set-output name=draft::true"
else
echo "::set-output name=version::${GITHUB_REF#refs/tags/}"
echo "::set-output name=draft::false"
fi
echo "::set-output name=date::$(env TZ=':America/Los_Angeles' date +'%Y-%m-%d')"
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: Checkout repository
uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Build
run: |
poetry build
- name: Create GitHub release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: ${{ steps.info.outputs.draft }}
files: |
dist/xml_dataclasses-*-py3-none-any.whl
dist/xml_dataclasses-*.tar.gz
name: ${{ steps.info.outputs.version }} (${{ steps.info.outputs.date }})
tag_name: ${{ steps.info.outputs.version }}
- name: Publish to PyPI
if: ${{ steps.info.outputs.draft == 'false' }}
run: |
poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}"
poetry publish