diff --git a/.github/workflows/check-pr.yaml b/.github/workflows/check-pr.yaml index 36b21ed..4f35e10 100644 --- a/.github/workflows/check-pr.yaml +++ b/.github/workflows/check-pr.yaml @@ -20,6 +20,9 @@ jobs: python_version: ["3.9", "3.10", "3.11", "3.12"] steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Task uses: arduino/setup-task@v1 with: @@ -35,9 +38,6 @@ jobs: with: version: 1.7.1 - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install dependencies run: task ci-init diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..ce62cb0 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,85 @@ +name: Release + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + get_versions: + name: Get local and remote versions + runs-on: ubuntu-22.04 + + permissions: + contents: read + + outputs: + local_version: ${{ steps.get_local_version.outputs.local_version }} + remote_version: ${{ steps.get_remote_version.outputs.remote_version }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install and configure Poetry + uses: snok/install-poetry@v1 + with: + version: 1.7.1 + + - name: Get local version + id: get_local_version + run: echo "local_version=$(poetry version --short)" >> $GITHUB_OUTPUT + + - name: Get remote version + id: get_remote_version + run: | + remote_version=$(curl https://pypi.org/pypi/secret-transfer/json | jq -r '.info.version' || echo "0.0.0") + echo "remote_version=$remote_version" >> $GITHUB_OUTPUT + + release: + name: Release + runs-on: ubuntu-22.04 + + needs: [get_versions] + if: ${{ needs.get_versions.outputs.local_version != needs.get_versions.outputs.remote_version }} + + permissions: + contents: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Task + uses: arduino/setup-task@v1 + with: + version: 3.33.1 + + - name: Set up Python + uses: actions/setup-python@v4 + + - name: Install and configure Poetry + uses: snok/install-poetry@v1 + with: + version: 1.7.1 + + - name: Install dependencies + run: task ci-init + + - name: Build + run: task ci-package-build + + - name: Publish + run: task ci-package-publish + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} + + - name: Create release + uses: ncipollo/release-action@v1 + with: + token: ${{ github.token }} + tag: ${{ needs.get_versions.outputs.local_version }} + artifacts: "dist/*" + generateReleaseNotes: true + skipIfReleaseExists: true diff --git a/LICENCE b/LICENCE new file mode 100644 index 0000000..d75aa94 --- /dev/null +++ b/LICENCE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 ovsds-example-organizaton + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Taskfile.yaml b/Taskfile.yaml index 7c42d0e..80c4792 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -300,14 +300,6 @@ tasks: - echo 'Installing python dependencies...' - poetry install - ci-login-pypi-publish: - desc: Login to PyPI (CI-specific) - requires: - envs: [PYPI_TOKEN] - cmds: - - echo 'Logging in to PyPI...' - - poetry config pypi-token.pypi $PYPI_TOKEN - ci-package-build: desc: Build package (CI-specific) cmds: diff --git a/pyproject.toml b/pyproject.toml index 28e0af9..f153636 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ license = "MIT" name = "secret-transfer" readme = "README.md" repository = "https://github.com/ovsds/secret-transfer" -version = "0.1.0" +version = "0.2.0" [tool.poetry.dependencies] click = "^8.1.3"