add portknock task #19
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
# This workflow will create and upload a Python Package for netunicorn-library | |
name: Release netunicorn-library | |
on: | |
push: | |
paths: | |
- "pyproject.toml" | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
outputs: | |
local_version_is_higher: ${{ steps.check-pypi-version.outputs.local_version_is_higher }} | |
local_version: ${{ steps.check-pypi-version.outputs.local_version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check if local version newer than PyPI version | |
id: check-pypi-version | |
uses: maybe-hello-world/pyproject-check-version@v2 | |
deploy: | |
runs-on: ubuntu-latest | |
environment: production | |
permissions: | |
contents: write | |
id-token: write | |
needs: check-version | |
if: ${{ needs.check-version.outputs.local_version_is_higher == 'true' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/checkout@v3 | |
with: | |
repository: netunicorn/netunicorn | |
path: temp/netunicorn | |
ref: main | |
- name: Copy files | |
run: | | |
cp -r pipelines temp/netunicorn/netunicorn-library/src/netunicorn/library/pipelines | |
cp -r tasks temp/netunicorn/netunicorn-library/src/netunicorn/library/tasks | |
cp pyproject.toml temp/netunicorn/netunicorn-library/pyproject.toml | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build | |
- name: Build package | |
run: cd temp/netunicorn/netunicorn-library && python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: "temp/netunicorn/netunicorn-library/dist" | |
- name: push tag | |
uses: anothrNick/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CUSTOM_TAG: ${{ needs.check-version.outputs.local_version }} | |
- name: GH Release | |
uses: softprops/[email protected] | |
with: | |
tag_name: ${{ needs.check-version.outputs.local_version }} | |
generate_release_notes: true | |