Skip to content

Update Data

Update Data #1119

Workflow file for this run

name: Update Data
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'schedule' || github.repository == 'biopragmatics/bioregistry' }}
steps:
- uses: actions/checkout@master
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
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install "tox<4.0.0"
############
# UPDATE #
############
- name: Create local changes
id: update
run: |
tox -e update
env:
BIOPORTAL_API_KEY: ${{ secrets.BIOPORTAL_API_KEY }}
ECOPORTAL_API_KEY: ${{ secrets.ECOPORTAL_API_KEY }}
AGROPORTAL_API_KEY: ${{ secrets.AGROPORTAL_API_KEY }}
FAIRSHARING_LOGIN: ${{ secrets.FAIRSHARING_LOGIN }}
FAIRSHARING_PASSWORD: ${{ secrets.FAIRSHARING_PASSWORD }}
NDEX_USERNAME: ${{ secrets.NDEX_USERNAME }}
NDEX_PASSWORD: ${{ secrets.NDEX_PASSWORD }}
- name: Check environment
run: echo ${{ steps.update.outputs.BR_UPDATED }}
- name: Commit files
if: steps.update.outputs.BR_UPDATED == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit --all -m "📮 Automatically update"
# Not sure if this should be here or not - what if it pushes something bad that needs to be reverted?
# - name: Push changes
# if: steps.update.outputs.BR_UPDATED == 'true'
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}
# tags: true
- name: Run tests, don't push to PyPI unless passing
if: steps.update.outputs.BR_UPDATED == 'true'
run: |
tox -e py
##################
# MARK RELEASE #
##################
- name: bump2version release
if: steps.update.outputs.BR_UPDATED == 'true'
run: |
tox -e bumpversion-release
##########
# PyPI #
##########
- name: Release to PyPI
if: steps.update.outputs.BR_UPDATED == 'true'
run: |
tox -e release
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
- name: bump2version patch
if: steps.update.outputs.BR_UPDATED == 'true'
run: |
tox -e bumpversion patch
- name: Push changes
if: steps.update.outputs.BR_UPDATED == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
- name: Sleep to avoid race conditions
if: steps.update.outputs.BR_UPDATED == 'true'
run: |
sleep 300
############
# DOCKER #
############
- name: Set up QEMU
if: steps.update.outputs.BR_UPDATED == 'true'
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
if: steps.update.outputs.BR_UPDATED == 'true'
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: steps.update.outputs.BR_UPDATED == 'true'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
if: steps.update.outputs.BR_UPDATED == 'true'
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
# See: https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md
platforms: linux/amd64,linux/arm64
tags: biopragmatics/bioregistry:latest
- name: Image digest
if: steps.update.outputs.BR_UPDATED == 'true'
run: echo ${{ steps.docker_build.outputs.digest }}