Merge pull request #77 from inspirehep/add-file-name #103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and release | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
env: | |
EXTRAS: all,postgresql | |
SQLALCHEMY_DATABASE_URI: "postgresql+psycopg2://postgres:postgres@localhost:5432/invenio" | |
permissions: | |
id-token: write | |
contents: write | |
actions: write | |
checks: write | |
deployments: write | |
discussions: write | |
issues: write | |
pages: read | |
packages: write | |
pull-requests: write | |
repository-projects: write | |
security-events: write | |
statuses: write | |
jobs: | |
test: | |
services: | |
postgres: | |
image: postgres | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_DATABASE: invenio | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
python-version: [2.7.17] | |
steps: | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade pip setuptools | |
pip install twine wheel coveralls | |
pip install -r requirements.txt | |
pip install -e .[${EXTRAS}] | |
- name: Show python dependencies | |
run: | | |
pip freeze | |
- name: Run tests | |
run: | | |
./run-tests.sh | |
push-to-master-check: | |
if: ${{ github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "Deploying branch $GITHUB_REF" | |
bump: | |
needs: | |
- test | |
- push-to-master-check | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
- name: Install bump2version | |
shell: bash | |
run: | | |
python -m pip install --upgrade pip | |
pip install bump2version | |
- name: Configure git | |
shell: bash | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Bump version | |
shell: bash | |
run: | | |
bump2version patch --tag --verbose | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} | |
tags: true | |
publish: | |
needs: bump | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 2.7.17 | |
- name: Install python dependencies | |
run: | | |
pip install --upgrade pip setuptools | |
pip install twine wheel coveralls | |
pip install -r requirements.txt | |
pip install -e .[${EXTRAS}] | |
- name: Show python dependencies | |
run: | | |
pip freeze | |
- name: Build package | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Publish package | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} |