forked from ersilia-os/ersilia
-
Notifications
You must be signed in to change notification settings - Fork 1
97 lines (80 loc) · 3.39 KB
/
publish.yaml
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
91
92
93
94
95
# Single workflow to increment ersilia version in pyproject.toml,
# tag and push the commit to the repository, release to GitHub, PyPI, Conda, and DockerHub
name: Ersilia Release
on:
workflow_dispatch: # run manually
schedule:
- cron: ' 0 3 1 * *' # run at 3:00 AM on the first day of the month
jobs:
version:
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.version.outputs.VERSION }}
steps:
- name: Checkout persist credentials
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # [email protected]
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- name: Increment package version
id: version
run: |
wget https://raw.githubusercontent.com/ersilia-os/ersilia/master/.github/scripts/static_version_writer.py
echo "VERSION=$(python static_version_writer.py)" >> "$GITHUB_OUTPUT"
rm static_version_writer.py
- name: Create a release tag
id: tag
run: |
git config --local user.email "[email protected]"
git config --local user.name "ersilia-bot"
git tag -a "v${{ steps.version.outputs.VERSION }}" -m "v${{ steps.version.outputs.VERSION }}"
- name: Commit and push changes done to the static version file and pyproject.toml
uses: actions-js/push@5a7cbd780d82c0c937b5977586e641b2fd94acc5 # [email protected]
with:
author_name: "ersilia-bot"
author_email: "[email protected]"
message: "update version [skip ci]"
repository: "ersilia-os/${{ github.event.repository.name }}"
github_token: ${{ secrets.GITHUB_TOKEN }}
amend: true
force: true
branch: "master"
gh-release:
runs-on: ubuntu-latest
needs: version
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Create GitHub release
id: gh_release
run: |
# Get the version file that we updated in the previous job
wget https://raw.githubusercontent.com/ersilia-os/ersilia/master/ersilia/_static_version.py
month=$(date +'%B')
year=$(date +'%Y')
title="Release $month $year"
version=`sed -n 's/.*version = "\([^"]*\)".*/\1/p' _static_version.py`
gh release create "v$version" --title "$title" --notes-from-tag
pypi-release:
runs-on: ubuntu-latest
needs: version
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # [email protected]
- name: Set up Python
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # [email protected]
with:
python-version: '3.8'
# cache: 'pip' # caching pip dependencies
- name: Get version
run: |
wget https://raw.githubusercontent.com/ersilia-os/ersilia/master/ersilia/_static_version.py
mv _static_version.py ersilia/.
- name: Python Poetry Action
uses: abatilo/[email protected]
- name: Build and publish
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
poetry config -- http-basic.pypi $PYPI_USERNAME $PYPI_PASSWORD
poetry --build publish