-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (59 loc) · 1.85 KB
/
ci.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
name: CI
# Events that trigger workflow
on:
push:
branches:
- "*"
pull_request:
jobs:
lint_python:
name: Lint Python Code
runs-on: ubuntu-22.04
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install Linters
run: make venv
- name: Lint
run: make lint
push_to_pypi:
name: Build (and publish, if applicable)
runs-on: ubuntu-22.04
needs: lint_python
steps:
- name: Check out Git repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Export Repo URL
run: echo "REPO_URL=https://github.com/${{ github.repository }}" >> $GITHUB_ENV
- name: Export Branch Name
run: echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: Set Up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install Dependencies
run: |
sudo apt-get install -y antlr4
curl -LO https://github.com/antlr/website-antlr4/raw/gh-pages/download/antlr-4.10.1-complete.jar
- name: Build Distribution
run: make ANTLR4="java -jar antlr-4.10.1-complete.jar"
- name: Set default for env.NEW_TAG
run: echo "NEW_TAG=NO_NEW_TAG" >> $GITHUB_ENV
- name: Check for new version
if: ${{ env.BRANCH_NAME == 'main' }}
run: |
make venv
cd ${GITHUB_WORKSPACE}/ && ./venv/bin/python3 .github/scripts/generate_tag.py
- name: Tag Commit
if: ${{ env.NEW_TAG != 'NO_NEW_TAG' }}
uses: tvdias/[email protected]
with:
tag: "${{ env.NEW_TAG }}"
repo-token: "${{ secrets.MY_TOKEN }}"
- name: Publish
if: ${{ env.NEW_TAG != 'NO_NEW_TAG' }}
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}