diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 323fe0c..c9bfa31 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -27,4 +27,45 @@ jobs: tag_name: ${{inputs.version}} generate_release_notes: true files: | - hstsparser.exe \ No newline at end of file + hstsparser.exe + + pypi: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: '3.11' + + - name: Cache Python modules + uses: actions/cache@v1 + env: + cache-name: cache-node-modules + with: + path: ~/.pip + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/poetry.lock') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: Install and configure Poetry + uses: snok/install-poetry@v1 + with: + version: 1.5.0 + virtualenvs-create: false + installer-parallel: true + + - name: Install Python Dependencies + run: poetry install --no-interaction --no-ansi --without=dev + env: + PIP_CACHE_DIR: ~/.pip + + - name: Update Package Version + run: poetry version ${{inputs.version}} + + - name: Publish to PyPi + run: poetry publish --build -u ${{secrets.pypi_username}} -p ${{secrets.pypi_password}} diff --git a/azure-pipelines/release-pipeline.yml b/azure-pipelines/release-pipeline.yml deleted file mode 100644 index 9060fd4..0000000 --- a/azure-pipelines/release-pipeline.yml +++ /dev/null @@ -1,104 +0,0 @@ -trigger: -- refs/tags/v* - -pr: none - -variables: - PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip - -jobs: - - job: PyPi - displayName: Publish to PyPi - - pool: - vmImage: windows-latest - - steps: - - task: UsePythonVersion@0 - displayName: 'Use Python 3.8.x' - inputs: - versionSpec: 3.8.x - addToPath: true - - - task: Cache@2 - inputs: - key: 'python | "$(Agent.OS)" | poetry.lock' - restoreKeys: | - python | "$(Agent.OS)" - python - path: $(PIP_CACHE_DIR) - displayName: Cache pip packages - - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: pip install poetry - displayName: Install Poetry - - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: 'poetry version $(git tag -l --points-at HEAD)' - displayName: Set Package Version - - - script: 'poetry install --no-interaction --no-ansi --no-dev' - displayName: Install project using Poetry - - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: 'poetry publish --build -u $(PyPi.Username) -p $(PyPi.Password)' - displayName: Publish pip package with Poetry - env: - PyPi.Username: $(PyPi.Username) - PyPi.Password: $(PyPi.Password) - - - job: GitHub - displayName: Publish to GitHub - - pool: - vmImage: windows-latest - - steps: - - task: UsePythonVersion@0 - displayName: 'Use Python 3.8.x' - inputs: - versionSpec: 3.8.x - addToPath: true - - - task: Cache@2 - inputs: - key: 'python | "$(Agent.OS)" | poetry.lock' - restoreKeys: | - python | "$(Agent.OS)" - python - path: $(PIP_CACHE_DIR) - displayName: Cache pip packages - - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: 'pip install poetry' - displayName: Install Poetry - - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: 'poetry version $(git tag -l --points-at HEAD)' - displayName: Set Package Version - - - script: 'poetry install --no-interaction --no-ansi' - displayName: Install project using Poetry - - - task: PowerShell@2 - inputs: - targetType: 'inline' - script: 'poetry run pyinstaller --onefile hstsparser.py' - displayName: 'Create Executable' - - - task: GitHubRelease@1 - displayName: 'GitHub release (create)' - inputs: - gitHubConnection: 'github.com' - tagPattern: '.*' - assets: '$(System.DefaultWorkingDirectory)\dist\hstsparser.exe'