-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[26] Add PyPi support in Github Actions
- Loading branch information
Showing
1 changed file
with
105 additions
and
88 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ on: | |
[push, pull_request] | ||
|
||
jobs: | ||
|
||
############################################################################## | ||
# Build job | ||
# | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Build and test | ||
|
@@ -15,57 +19,64 @@ jobs: | |
|
||
steps: | ||
|
||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
|
||
- 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 | ||
pip install -r requirements-dev.txt | ||
- name: Make all tests with make | ||
run: make test | ||
|
||
- name: SonarCloud Scan | ||
if: matrix.python-version == '3.8' | ||
uses: sonarsource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
|
||
- name: Package | ||
if: matrix.python-version == '3.8' | ||
run: make dist | ||
|
||
- name: Archive package | ||
if: matrix.python-version == '3.8' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: seedboxsync-${{ github.sha }}.tar.gz | ||
path: dist/*.tar.gz | ||
|
||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
|
||
- 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 | ||
pip install -r requirements-dev.txt | ||
- name: Make all tests with make | ||
run: make test | ||
|
||
- name: SonarCloud Scan | ||
if: matrix.python-version == '3.8' | ||
uses: sonarsource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
|
||
- name: Package | ||
if: matrix.python-version == '3.8' | ||
run: make dist | ||
|
||
- name: Archive package | ||
if: matrix.python-version == '3.8' | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: seedboxsync-${{ github.sha }}.tar.gz | ||
path: dist/*.tar.gz | ||
|
||
|
||
############################################################################## | ||
# Markdownlint job | ||
# | ||
markdownlint: | ||
runs-on: ubuntu-latest | ||
name: MarkdownLint | ||
|
||
steps: | ||
|
||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: markdownlint-cli | ||
uses: nosborn/[email protected] | ||
with: | ||
files: "*.md docs/*.md" | ||
config_file: ".markdownlint.yaml" | ||
|
||
- name: markdownlint-cli | ||
if: matrix.python-version == '3.8' | ||
uses: nosborn/[email protected] | ||
with: | ||
files: "*.md docs/*.md" | ||
config_file: ".markdownlint.yaml" | ||
|
||
############################################################################## | ||
# Realse job | ||
# | ||
release: | ||
needs: [ | ||
build, | ||
|
@@ -76,48 +87,54 @@ jobs: | |
name: Release on GitHub and PyPi | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set env | ||
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF:11} | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install -r requirements-dev.txt | ||
- name: Package | ||
run: make dist | ||
|
||
- name: Create GitHub release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body: | | ||
Changes in this Release | ||
- First Change | ||
- Second Change | ||
draft: true | ||
prerelease: false | ||
|
||
- name: Upload asset in GitHub release | ||
id: upload-release-asset | ||
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/seedboxsync-${{ env.RELEASE_VERSION }}.tar.gz | ||
asset_name: seedboxsync-${{ env.RELEASE_VERSION }}.tar.gz | ||
asset_content_type: application/tar+gzip | ||
- name: Git checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set env | ||
run: echo ::set-env name=RELEASE_VERSION::${GITHUB_REF:11} | ||
|
||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: '3.8' | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install -r requirements-dev.txt | ||
- name: Package | ||
run: make dist | ||
|
||
- name: Create GitHub release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body: | | ||
Changes in this Release | ||
- First Change | ||
- Second Change | ||
draft: true | ||
prerelease: false | ||
|
||
- name: Upload asset in GitHub release | ||
id: upload-release-asset | ||
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/seedboxsync-${{ env.RELEASE_VERSION }}.tar.gz | ||
asset_name: seedboxsync-${{ env.RELEASE_VERSION }}.tar.gz | ||
asset_content_type: application/tar+gzip | ||
|
||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@master | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_PASSWORD }} |