-
Notifications
You must be signed in to change notification settings - Fork 10
76 lines (65 loc) · 2.17 KB
/
netunicorn-library-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
# This workflow will create and upload a Python Package for netunicorn-library
name: Release netunicorn-library
on:
push:
paths:
- "pyproject.toml"
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
local_version_is_higher: ${{ steps.check-pypi-version.outputs.local_version_is_higher }}
local_version: ${{ steps.check-pypi-version.outputs.local_version }}
steps:
- uses: actions/checkout@v3
- name: Check if local version newer than PyPI version
id: check-pypi-version
uses: maybe-hello-world/pyproject-check-version@v2
deploy:
runs-on: ubuntu-latest
environment: production
permissions:
contents: write
id-token: write
needs: check-version
if: ${{ needs.check-version.outputs.local_version_is_higher == 'true' }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: netunicorn/netunicorn
path: temp/netunicorn
ref: main
- name: Copy files
run: |
cp -r pipelines temp/netunicorn/netunicorn-library/src/netunicorn/library/pipelines
cp -r tasks temp/netunicorn/netunicorn-library/src/netunicorn/library/tasks
cp pyproject.toml temp/netunicorn/netunicorn-library/pyproject.toml
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: cd temp/netunicorn/netunicorn-library && python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: "temp/netunicorn/netunicorn-library/dist"
- name: push tag
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CUSTOM_TAG: ${{ needs.check-version.outputs.local_version }}
- name: GH Release
uses: softprops/[email protected]
with:
tag_name: ${{ needs.check-version.outputs.local_version }}
generate_release_notes: true