mirror of
https://github.com/moepman/acertmgr.git
synced 2024-12-29 12:31:52 +01:00
Github Action: Update to newer github action syntax/standards, change image to ubuntu-latest, change pypi-publish to supported version and check if we have credentials to publish at all
This commit is contained in:
parent
c3736c0838
commit
f78cb5c554
29
.github/workflows/release.yml
vendored
29
.github/workflows/release.yml
vendored
@ -3,16 +3,16 @@ name: Build (and release)
|
|||||||
on: [ push, pull_request ]
|
on: [ push, pull_request ]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt update -qq -y
|
sudo apt update -qq -y
|
||||||
sudo apt install -qq -y build-essential fakeroot git python-all python3-cryptography python3-pip python3-stdeb python3-wheel twine
|
sudo apt install -qq -y build-essential fakeroot git python-all python3-cryptography python3-pip python3-stdeb python3-wheel twine dh-python
|
||||||
sudo pip3 install --upgrade setuptools wheel
|
sudo pip3 install --upgrade setuptools wheel
|
||||||
|
|
||||||
- name: Prepare build process
|
- name: Prepare build process
|
||||||
@ -22,7 +22,7 @@ jobs:
|
|||||||
git fetch --tags -f
|
git fetch --tags -f
|
||||||
VER="$(python3 setup.py --version)"
|
VER="$(python3 setup.py --version)"
|
||||||
echo "Version found: $VER"
|
echo "Version found: $VER"
|
||||||
echo "::set-output name=version::$VER"
|
echo "version=$VER" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Build python package using setuptools (source/wheel)
|
- name: Build python package using setuptools (source/wheel)
|
||||||
run: |
|
run: |
|
||||||
@ -36,9 +36,9 @@ jobs:
|
|||||||
sed "s/=determine_version()/='$(python3 setup.py --version)'/gi" -i setup.py
|
sed "s/=determine_version()/='$(python3 setup.py --version)'/gi" -i setup.py
|
||||||
sed "s@('readme'@('share/doc/python3-acertmgr'@" -i setup.py
|
sed "s@('readme'@('share/doc/python3-acertmgr'@" -i setup.py
|
||||||
# Determine recommended dependencies for deb package
|
# Determine recommended dependencies for deb package
|
||||||
echo "::set-output name=recommends3::$(echo "python3-pkg-resources")"
|
echo "recommends3=$(echo "python3-pkg-resources")" >> $GITHUB_OUTPUT
|
||||||
# Find optional dependencies to suggest in deb package
|
# Find optional dependencies to suggest in deb package
|
||||||
echo "::set-output name=suggests3::$(python3 -c "from setup import extra_requirements; print('\n'.join(['\n'.join(x) for x in extra_requirements.values()]))" | grep -v cryptography | sed 's/PyYAML/yaml/gi' | awk '{ printf("python3-%s, ",$1)};' | awk '{$1=$1; print}')"
|
echo "suggests3=$(python3 -c "from setup import extra_requirements; print('\n'.join(['\n'.join(x) for x in extra_requirements.values()]))" | grep -v cryptography | sed 's/PyYAML/yaml/gi' | awk '{ printf("python3-%s, ",$1)};' | awk '{$1=$1; print}')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Build debian package using setuptools and stdeb
|
- name: Build debian package using setuptools and stdeb
|
||||||
run: python3 setup.py --command-packages=stdeb.command sdist_dsc --with-python2=False --with-python3=True --recommends3="${{ steps.stdebprep.outputs.recommends3 }}" --suggests3="${{ steps.stdebprep.outputs.suggests3 }}" bdist_deb
|
run: python3 setup.py --command-packages=stdeb.command sdist_dsc --with-python2=False --with-python3=True --recommends3="${{ steps.stdebprep.outputs.recommends3 }}" --suggests3="${{ steps.stdebprep.outputs.suggests3 }}" bdist_deb
|
||||||
@ -85,9 +85,22 @@ jobs:
|
|||||||
artifacts/*.whl
|
artifacts/*.whl
|
||||||
artifacts/*.deb
|
artifacts/*.deb
|
||||||
|
|
||||||
|
- name: Check PyPI secrets
|
||||||
|
id: checksecrets
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if [ "$USER" == "" -o "$PASSWORD" == "" ]; then
|
||||||
|
echo "secretspresent=NO" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "secretspresent=YES" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
env:
|
||||||
|
USER: ${{ secrets.PYPI_USERNAME }}
|
||||||
|
PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
||||||
|
|
||||||
- name: Create new PyPI release
|
- name: Create new PyPI release
|
||||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && (!(contains(github.ref, 'rc') || contains(github.ref, 'pre')))
|
if: steps.checksecrets.outputs.secretspresent == 'YES' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && (!(contains(github.ref, 'rc') || contains(github.ref, 'pre')))
|
||||||
uses: pypa/gh-action-pypi-publish@master
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
with:
|
with:
|
||||||
user: ${{ secrets.PYPI_USERNAME }}
|
user: ${{ secrets.PYPI_USERNAME }}
|
||||||
password: ${{ secrets.PYPI_PASSWORD }}
|
password: ${{ secrets.PYPI_PASSWORD }}
|
||||||
|
Loading…
Reference in New Issue
Block a user