diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index c99e0b4..0000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Lint Ansible and Python - -on: [push] - -jobs: - ansible-lint: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install dependencies - run: python -m pip install ansible-lint - - - name: Lint with ansible-lint - run: ansible-lint -v - - pycodestyle: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install dependencies - run: pip install pycodestyle - - - name: Lint with pycodestyle - run: python -m pycodestyle molecule_qemu diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 640d66c..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Pypi Publish - -on: - release: - types: [published] - -permissions: - contents: read - -jobs: - publish: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install dependencies - run: python -m pip install build --user - - - name: Build a binary wheel and a source tarball - run: python -m build --sdist --wheel --outdir dist/ . - - - name: Publish package - if: startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..7843dfe --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,113 @@ +name: Python Package + +on: [push] + +permissions: + contents: read + +jobs: + lint-ansible: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: pip install ansible-lint + + - name: Lint with ansible-lint + run: ansible-lint -v + + lint-python: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: pip install pycodestyle + + - name: Lint with pycodestyle + run: python -m pycodestyle molecule_qemu + + build: + runs-on: ubuntu-latest + needs: [lint-ansible, lint-python] + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: python -m pip install build --user + + - name: Build a binary wheel and a source tarball + run: python -m build --sdist --wheel --outdir dist/ . + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: python-package + path: 'dist/*' + + publish: + runs-on: ubuntu-latest + needs: build + if: startsWith(github.ref, 'refs/tags/v') + + steps: + - uses: actions/download-artifact@v3 + with: + name: python-package + + - name: Publish package + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + packages-dir: . + + release: + runs-on: ubuntu-latest + needs: build + if: startsWith(github.ref, 'refs/tags/v') + + permissions: + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Check if pre-release + id: prerelease + run: | + echo "prerelease=$(if [[ "${{ github.ref }}" == *"rc"* ]]; then echo "true"; else echo "false"; fi)" >> "$GITHUB_OUTPUT" + + - uses: actions/download-artifact@v3 + with: + name: python-package + + - name: Release + uses: softprops/action-gh-release@v1 + with: + prerelease: ${{ steps.prerelease.outputs.prerelease }} + generate_release_notes: true + files: | + *.whl + *.tar.gz diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 3883191..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Github Release - -on: - push: - tags: - - "v*.*.*" - -jobs: - release: - permissions: - contents: write - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Check if pre-release - id: prerelease - run: | - echo "prerelease=$(if [[ "${{ github.ref }}" == *"rc"* ]]; then echo "true"; else echo "false"; fi)" >> "$GITHUB_OUTPUT" - - - name: Release - uses: softprops/action-gh-release@v1 - with: - draft: true - prerelease: ${{ steps.prerelease.outputs.prerelease }} - generate_release_notes: true