-
Notifications
You must be signed in to change notification settings - Fork 8
47 lines (40 loc) · 1.46 KB
/
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
# This workflow is triggered when a PR is merged whose source branch's name starts with "release" and whose target branch is "main".
# It checks for the current package version (in pyproject.toml) and the latest tag on GitHub.
# If package version is more recent, it builds the project, uploads to PYPI, creates a Tag and makes a release on GitHub.
# Secrets PYPI_USERNAME and PYPI_PASSWORD are required!
name: Check and release
on:
pull_request:
branches: [main]
types: [closed]
jobs:
build:
defaults:
run:
shell: bash
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release')
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Poetry
run: |
export POETRY_HOME=/opt/poetry
python3 -m venv $POETRY_HOME
$POETRY_HOME/bin/pip install poetry==1.4.0
$POETRY_HOME/bin/poetry --version
- name: Run release script
env:
PYPI_USERNAME: __token__
PYPI_PASSWORD: ${{secrets.FETCHBOT_PYPI_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ github.token }}
run: |
pip install tomli packaging poetry
git config --global user.email "ci-bot@fetch.ai"
git config --global user.name "CI BOT"
python3 ./scripts/do_release.py