Skip to content

trigger dev release generation #62

trigger dev release generation

trigger dev release generation #62

Workflow file for this run

name: stable build release
on:
push:
tags:
- '[0-9].[0-9].*'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v2
with:
lfs: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 pds_doi_core --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 pds_doi_core --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Deploy locally
run: |
pip install .
- name: Update default configuration
run: |
import sys
import os
from pathlib import Path
conf_dir = os.path.join(sys.prefix, "pds_doi_core")
Path(conf_dir).mkdir(parents=True, exist_ok=True)
conf_file = os.path.join(conf_dir, "conf.ini")
print(f"Create config file for unit test {conf_file}")
with open(conf_file, "w") as f:
f.write("[OSTI]\n")
f.write("user = {}\n".format("${{secrets.osti_login}}"))
f.write("password = {}\n".format("${{secrets.osti_password}}"))
shell: python
- name: Unit Tests
run: |
pip install pytest
pytest
- name: Create the package
run: |
pip install setuptools wheel
rm -f dist/*
python setup.py sdist bdist_wheel
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: pds-doi-service ${{ github.ref }}
draft: false
prerelease: false
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Upload Release Asset tar gz
id: upload-release-asset-targz
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: dist/pds_doi_core-${{ steps.get_version.outputs.VERSION }}.tar.gz
asset_name: pds_doi_core-${{ steps.get_version.outputs.VERSION }}.tar.gz
asset_content_type: application/tar+gzip
- name: Upload Release Asset whl
id: upload-release-asset-whl
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: dist/pds_doi_core-${{ steps.get_version.outputs.VERSION }}-py3-none-any.whl
asset_name: pds_doi_core-${{ steps.get_version.outputs.VERSION }}-py3-none-any.whl
asset_content_type: application/x-pywheel+zip
- name: Publish the Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: ${{ secrets.pypi_username }}
password: ${{ secrets.pypi_password }}
# the changelog will be available on https://nasa-pds.github.io/<your repo>/pdesen-corral/CHANGELOG
- uses: actions/checkout@v2
with:
ref: gh-pages
- name: Create changelog & requirements
run: |
#sudo gem install github_changelog_generator
# deploy from source, does no work yet, nice to have for a feature to have issues' labels in changelog
git clone https://github.com/github-changelog-generator/github-changelog-generator.git
#gem sources --add https://rubygems.org/
cd github-changelog-generator
gem build github_changelog_generator.gemspec
sudo gem install github_changelog_generator-1.15.2.gem --source http://rubygems.org
cd ..
github_changelog_generator --user NASA-PDS --project pds-doi-service --output pdsen-corral/CHANGELOG.md --token ${{ secrets.GITHUB_TOKEN }} --configure-sections '{"improvements":{"prefix":"**Improvements:**","labels":["Epic"]},"defects":{"prefix":"**Defects:**","labels":["bug"]},"deprecations":{"prefix":"**Deprecations:**","labels":["deprecation"]}}' --no-pull-requests --issues-label '**Other closed issues:**' --issue-line-labels high,low,medium
- name: Create requirements files
run: |
pip install pds-github-util
echo ::set-env name=REQUIREMENT_FILE::$(requirement-report --organization NASA-PDS --repository pds-doi-service --output pdsen-corral --token ${{ secrets.GITHUB_TOKEN }})
- name: Commit CHANGELOG.md and requirement files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
echo "commit pdsen-corral/CHANGELOG.md and ${{ env.REQUIREMENT_FILE }}on gh-pages branch"
git add pdsen-corral/CHANGELOG.md ${{ env.REQUIREMENT_FILE }}
git commit -m "update changelog and requirements" --allow-empty
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
- name: Ping pdsen-corral
run: |
pip install pds-github-util
git-ping --repo nasa-pds/pdsen-corral --token ${{ secrets.ADMIN_GITHUB_TOKEN }} --branch master --message 'pds-doi-service has been upgrade to ${{ github.ref }}'