Publish #42
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: Publish | |
on: | |
schedule: | |
- cron: '0 0 1 */2 *' | |
workflow_dispatch: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone the repository | |
uses: actions/checkout@v2 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Delete previously generated files | |
run: rm -rf megago/resources && mkdir -p megago/resources | |
- name: Download the most recent SwissProt associations file | |
run: wget "https://rest.uniprot.org/uniprotkb/search?fields=accession,go_id&format=tsv&query=(*)+AND+(reviewed:true)" -O megago/resources/associations-swissprot.tab | |
- name: Remove spaces after semicolons from UniProt file | |
run: sed -i "s/; /;/g" megago/resources/associations-swissprot.tab | |
- name: Download the most recent GO DAG file | |
run: wget "http://purl.obolibrary.org/obo/go/go-basic.obo" -O megago/resources/go-basic.obo | |
- name: Install required dependencies | |
run: | | |
python3 -m pip install --upgrade pip | |
pip3 install -r requirements-dev.txt | |
pip3 install wheel | |
- name: Precompute the frequency counts | |
run: python3 -m megago.precompute_frequency_counts | |
- name: Precompute the highest IC values | |
run: python3 -m megago.precompute_highest_ic | |
- name: Install Twine (required for publishing the package on PyPi) | |
run: pip3 install twine | |
- name: Delete previously generated distributions | |
run: rm -rf dist | |
- name: Get UniProt database version | |
id: date | |
run: echo "::set-output name=date::$(wget -O - https://www.uniprot.org/downloads 2> /dev/null | grep 'uniprot.releasedate' |sed 's/^.* .\([_0-9]*\).*$/\1/' | sed 's/_/./')" | |
- name: Compute correct package version | |
id: version_number | |
run: echo "::set-output name=version_number::$(cat setup.py | sed -n '/version=/p' | sed 's/^.*version=.\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$/\1/')" | |
- name: Setup correct version numbering | |
run: sed -i "s/version='\([^']*\)'/version='${{ steps.version_number.outputs.version_number }}.${{ steps.date.outputs.date }}'/" setup.py | |
- name: Generate packages for distribution | |
run: python setup.py sdist bdist_wheel | |
- name: Upload generated packages to PyPi | |
run: twine upload dist/* | |
env: | |
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} | |
- name: Bump the current setup file (which contains the current version number) | |
uses: test-room-7/action-update-file@v1 | |
with: | |
file-path: setup.py | |
commit-msg: Bump package version to ${{ steps.date.outputs.date }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get newly made commit sha | |
id: commit_sha | |
shell: bash | |
run: | | |
echo "::set-output name=sha::$(git rev-parse HEAD)" | |
- name: Create new tag | |
uses: octokit/[email protected] | |
id: create_new_tag | |
with: | |
route: POST /repos/:owner/:repo/git/tags | |
owner: mega-go | |
repo: megago | |
tag: v${{ steps.version_number.outputs.version_number }}.${{ steps.date.outputs.date }} | |
message: "Automatic release v${{ steps.version_number.outputs.version_number }}.${{ steps.date.outputs.date }}" | |
object: ${{ steps.commit_sha.outputs.sha }} | |
type: commit | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: v${{ steps.version_number.outputs.version_number }}.${{ steps.date.outputs.date }} | |
release_name: Data release for UniProt at ${{ steps.date.outputs.date }} | |
draft: false | |
prerelease: false |