-
-
Notifications
You must be signed in to change notification settings - Fork 52
119 lines (114 loc) · 4.13 KB
/
update.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
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 }}