125 lines
3.9 KiB
YAML
125 lines
3.9 KiB
YAML
# This workflow will upload a Python Package using Twine when a release is created
|
|
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
|
|
|
name: Upload Python Package
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version_part:
|
|
description: 'Which part of the version to increment (patch, minor, major)'
|
|
required: true
|
|
default: 'patch'
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2.3.4
|
|
|
|
# Environment Setup
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2.2.2
|
|
with:
|
|
python-version: '3.7'
|
|
|
|
- name: Run ci_tests
|
|
run: ./ci_tests
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install devscripts equivs sphinx-common sphinx-rtd-theme-common # dh-virtualenv deps
|
|
apt-get install debhelper dh-python python3-all # stdeb deps
|
|
apt-get install dpkg-sig # signing deps
|
|
|
|
- name: Install dh-virtualenv
|
|
run: |
|
|
git clone https://github.com/spotify/dh-virtualenv.git
|
|
cd dh-virtualenv
|
|
mk-build-deps -ri
|
|
dpkg-buildpackage -us -uc -b
|
|
cd ..
|
|
dpkg -i dh-virtualenv_*.deb
|
|
|
|
- name: Install GPG secret key
|
|
run: |
|
|
echo -e "${{ secrets.QMK_GPG_SECRET_KEY }}" | gpg --batch --import
|
|
gpg --list-secret-keys --keyid-format LONG
|
|
|
|
- name: Install python dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install setuptools wheel
|
|
pip install -r requirements-dev.txt
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v1.10.0
|
|
with:
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
# Build and upload new Python package
|
|
- name: Bump version
|
|
run: |
|
|
git config --local user.email "hello@qmk.fm"
|
|
git config --local user.name "QMK Bot"
|
|
bumpversion ${{ github.event.inputs.version_part }}
|
|
|
|
- name: Push changes
|
|
uses: ad-m/github-push-action@master
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
branch: master
|
|
tags: true
|
|
|
|
- name: Build and publish
|
|
env:
|
|
TWINE_USERNAME: qmk
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
run: |
|
|
python setup.py sdist bdist_wheel
|
|
twine upload dist/*
|
|
|
|
# Build and upload new Docker container
|
|
- name: Build and Push to Docker Hub
|
|
uses: docker/build-push-action@v2.6.1
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: qmkfm/qmk_cli:latest
|
|
|
|
# Build Debian package
|
|
- name: Build debian package
|
|
run: |
|
|
python3 setup.py bdist_deb
|
|
dpkg-sig -s builder -k F464DFD46C4DA3FD4D06234691B06358D2CAE8AE deb_dist/*.deb
|
|
|
|
# Create Debian repo
|
|
- name: Build debian package repository
|
|
run: |
|
|
mkdir -p deb_repo/deb deb_repo/dsc
|
|
cp gpg_pubkey.txt deb_repo
|
|
cp deb_dist/*.deb deb_repo/deb
|
|
cp deb_dist/*.dsc deb_dist/*.orig.tar.gz deb_dist/*.debian.tar.xz deb_repo/dsc
|
|
cd deb_repo
|
|
apt-ftparchive packages deb > Packages
|
|
apt-ftparchive sources dsc > Sources
|
|
gzip -k {Packages,Sources}
|
|
apt-ftparchive release . > Release
|
|
gpg --default-key F464DFD46C4DA3FD4D06234691B06358D2CAE8AE -abs -o Release.gpg Release
|
|
gpg --default-key F464DFD46C4DA3FD4D06234691B06358D2CAE8AE --clearsign -o InRelease Release
|
|
|
|
# Upload the Debian repo to S3
|
|
- name: Upload Debian Repo
|
|
uses: jakejarvis/s3-sync-action@0.5.1
|
|
with:
|
|
args: --acl public-read --follow-symlinks --delete
|
|
env:
|
|
AWS_S3_BUCKET: qmk-debian
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.SPACES_ACCESS_KEY }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.SPACES_SECRET_KEY }}
|
|
AWS_S3_ENDPOINT: https://nyc3.digitaloceanspaces.com
|
|
SOURCE_DIR: 'deb_repo'
|