diff --git a/.github/workflows/pr-title.yaml b/.github/workflows/pr-title.yaml index 0540e11..3c07725 100644 --- a/.github/workflows/pr-title.yaml +++ b/.github/workflows/pr-title.yaml @@ -12,6 +12,8 @@ jobs: name: "Title" runs-on: ubuntu-20.04 permissions: write-all + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} steps: - name: "Check PR title" uses: amannn/action-semantic-pull-request@v5 @@ -27,5 +29,3 @@ jobs: requireScope: false wip: true validateSingleCommit: false - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..7b65a46 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,25 @@ +name: Publish +on: + release: + types: + - created + +jobs: + publish-pypi: + name: "Release to PYPI" + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + - name: Install poetry + uses: abatilo/actions-poetry@v2 + with: + poetry-version: '1.3.2' + - name: Publish + env: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: | + poetry config pypi-token.pypi $PYPI_TOKEN + poetry publish --build diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 39a2ca0..e918e97 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -1,35 +1,21 @@ name: Push on: push: - branches-ignore: [ main ] + branches-ignore: + - main + workflow_call: + workflow_dispatch: jobs: - test: - runs-on: ubuntu-latest + check: + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - name: Install python + uses: actions/setup-python@v4 with: python-version: '3.10' - - name: Run image - uses: abatilo/actions-poetry@v2 - with: - poetry-version: '1.3.2' - - name: Install dependencies - run: poetry install - - name: Run tests - run: poetry run pytest --cov=./ --cov-report=xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - - code-style: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Run image + - name: Install poetry uses: abatilo/actions-poetry@v2 with: poetry-version: '1.3.2' @@ -39,24 +25,17 @@ jobs: run: poetry run black . - name: Run isort run: poetry run isort . --profile black - - code-quality: - needs: code-style - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 + - name: Commit style changes + uses: stefanzweifel/git-auto-commit-action@v4 with: - python-version: '3.10' - - name: Run image - uses: abatilo/actions-poetry@v2 - with: - poetry-version: '1.3.2' - - name: Install dependencies - run: poetry install - - name: Run black + commit_message: "fix: style fixes" + - name: Check black run: poetry run black . --check - - name: Run isort + - name: Check isort run: poetry run isort . --check-only --profile black - - name: Run flake8 + - name: Check flake8 run: poetry run flake8 . --max-line-length 120 + - name: Run tests + run: poetry run pytest --cov=./ --cov-report=xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v2 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a8d3bfb..62c7489 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,77 +4,26 @@ on: branches: [ main ] jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Run image - uses: abatilo/actions-poetry@v2 - with: - poetry-version: '1.3.2' - - name: Install dependencies - run: poetry install - - name: Run tests - run: poetry run pytest --cov=./ --cov-report=xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 - - code-style: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Run image - uses: abatilo/actions-poetry@v2 - with: - poetry-version: '1.3.2' - - name: Install dependencies - run: poetry install - - name: Run black - run: poetry run black . - - name: Run isort - run: poetry run isort . --profile black - - code-quality: - needs: code-style - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Run image - uses: abatilo/actions-poetry@v2 - with: - poetry-version: '1.3.2' - - name: Install dependencies - run: poetry install - - name: Run black - run: poetry run black . --check - - name: Run isort - run: poetry run isort . --check-only --profile black - - name: Run flake8 - run: poetry run flake8 . --max-line-length 120 + tests: + name: "Run tests" + uses: ./.github/workflows/push.yaml + secrets: inherit release: - needs: [test, code-quality] - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):') - runs-on: ubuntu-latest + needs: tests + name: "Release" + runs-on: ubuntu-20.04 + permissions: write-all + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} steps: - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: '3.10' - - name: Install Python Poetry - uses: abatilo/actions-poetry@v2 - with: - poetry-version: '1.3.2' - - uses: bjoluc/semantic-release-config-poetry@v2 - with: - pypi_token: ${{ secrets.PYPI_TOKEN }} - github_token: ${{ secrets.GH_TOKEN }} + - name: Release + uses: cycjimmy/semantic-release-action@v3 + with: + semantic_version: 18.0.0 + extra_plugins: | + @semantic-release/changelog@6.0.0 + @semantic-release/exec@6.0.3 + @semantic-release/git@10.0.0 + conventional-changelog-conventionalcommits@4.6.3 diff --git a/.gitignore b/.gitignore index 0f8b768..167bf03 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ venv/ testing/ *.xml *.prom +poetry.lock diff --git a/.releaserc.json b/.releaserc.json new file mode 100644 index 0000000..a5a023d --- /dev/null +++ b/.releaserc.json @@ -0,0 +1,51 @@ +{ + "branches": [ + "main" + ], + "ci": false, + "plugins": [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits" + } + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits" + } + ], + [ + "@semantic-release/github", + { + "successComment": "This ${issue.pull_request ? 'PR is included' : 'issue has been resolved'} in version ${nextRelease.version} :tada:", + "labels": false, + "releasedLabels": false + } + ], + [ + "@semantic-release/changelog", + { + "changelogFile": "CHANGELOG.md", + "changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file." + } + ], + [ + "@semantic-release/exec", + { + "prepareCmd": "sed -i 's/^version.*$/version = \"${nextRelease.version}\"/' pyproject.toml ; cat pyproject.toml" + } + ], + [ + "@semantic-release/git", + { + "assets": [ + "CHANGELOG.md", + "pyproject.toml" + ], + "message": "chore(release): version ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + } + ] + ] +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index c65a333..3f77d25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,99 @@ # Changelog -All notable changes to this project will be documented in this file. See +All notable changes to this project will be documented in this file. + +### [1.0.7](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.6...v1.0.7) (2023-10-11) + + +### Bug Fixes + +* semantic release ([#76](https://github.com/cloud-labs-infra/github-backup/issues/76)) ([a502cc1](https://github.com/cloud-labs-infra/github-backup/commit/a502cc1788ebc20a531e393f3d950b286a219a2d)) +* update pyproject.toml ([3df679e](https://github.com/cloud-labs-infra/github-backup/commit/3df679e2a85683218c16700732ac5a68f8f0ba9d)) +* update pyproject.toml ([24f557d](https://github.com/cloud-labs-infra/github-backup/commit/24f557d2598d3976c2341bf560e367fefdd67b1e)) +* update pyproject.toml ([5d03720](https://github.com/cloud-labs-infra/github-backup/commit/5d03720c655ec89c3460cc9de991465107fc1a50)) +* update pyproject.toml ([1a924a1](https://github.com/cloud-labs-infra/github-backup/commit/1a924a1c31e643c796af1c5e9a3c09a02492d6de)) + +### [1.0.7](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.6...v1.0.7) (2023-10-10) + + +### Bug Fixes + +* semantic release ([#76](https://github.com/cloud-labs-infra/github-backup/issues/76)) ([a502cc1](https://github.com/cloud-labs-infra/github-backup/commit/a502cc1788ebc20a531e393f3d950b286a219a2d)) +* update pyproject.toml ([24f557d](https://github.com/cloud-labs-infra/github-backup/commit/24f557d2598d3976c2341bf560e367fefdd67b1e)) +* update pyproject.toml ([5d03720](https://github.com/cloud-labs-infra/github-backup/commit/5d03720c655ec89c3460cc9de991465107fc1a50)) +* update pyproject.toml ([1a924a1](https://github.com/cloud-labs-infra/github-backup/commit/1a924a1c31e643c796af1c5e9a3c09a02492d6de)) + +### [1.0.7](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.6...v1.0.7) (2023-10-10) + + +### Bug Fixes + +* semantic release ([#76](https://github.com/cloud-labs-infra/github-backup/issues/76)) ([a502cc1](https://github.com/cloud-labs-infra/github-backup/commit/a502cc1788ebc20a531e393f3d950b286a219a2d)) +* update pyproject.toml ([5d03720](https://github.com/cloud-labs-infra/github-backup/commit/5d03720c655ec89c3460cc9de991465107fc1a50)) +* update pyproject.toml ([1a924a1](https://github.com/cloud-labs-infra/github-backup/commit/1a924a1c31e643c796af1c5e9a3c09a02492d6de)) + +### [1.0.7](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.6...v1.0.7) (2023-10-10) + + +### Bug Fixes + +* semantic release ([#76](https://github.com/cloud-labs-infra/github-backup/issues/76)) ([a502cc1](https://github.com/cloud-labs-infra/github-backup/commit/a502cc1788ebc20a531e393f3d950b286a219a2d)) +* update pyproject.toml ([1a924a1](https://github.com/cloud-labs-infra/github-backup/commit/1a924a1c31e643c796af1c5e9a3c09a02492d6de)) + +### [1.0.7](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.6...v1.0.7) (2023-10-10) + + +### Bug Fixes + +* semantic release ([#76](https://github.com/cloud-labs-infra/github-backup/issues/76)) ([a502cc1](https://github.com/cloud-labs-infra/github-backup/commit/a502cc1788ebc20a531e393f3d950b286a219a2d)) + +### [1.0.10](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.9...v1.0.10) (2023-10-09) + + +### Bug Fixes + +* release branch ([579397b](https://github.com/cloud-labs-infra/github-backup/commit/579397b7fe9bc049f26b82c551608bc0f2bc8b5a)) +* remove exec install ([a60f65c](https://github.com/cloud-labs-infra/github-backup/commit/a60f65c4abd3066816f3d7bec599be6f42a67c9a)) + +### [1.0.9](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.8...v1.0.9) (2023-10-09) + + +### Bug Fixes + +* publish workflow ([73919df](https://github.com/cloud-labs-infra/github-backup/commit/73919df33098d2b99663ba7177ed41e3423d8997)) + +### [1.0.8](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.7...v1.0.8) (2023-10-09) + + +### Bug Fixes + +* step name ([a9b59e7](https://github.com/cloud-labs-infra/github-backup/commit/a9b59e7c45ace5ac00afbe87c3e227ba6af3da9e)) + +### [1.0.7](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.6...v1.0.7) (2023-10-09) + + +### Bug Fixes + +* commit style changes ([52c0a43](https://github.com/cloud-labs-infra/github-backup/commit/52c0a43658abfd89261e5413e49da7543f2c39df)) +* style fixes ([3c7d1f7](https://github.com/cloud-labs-infra/github-backup/commit/3c7d1f71931ba17461a260ba76819dc6e7d90c52)) + +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.6](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.5...v1.0.6) (2023-10-09) + + +### Bug Fixes + +* update pyproject.toml ([b7f1120](https://github.com/cloud-labs-infra/github-backup/commit/b7f112053cbdf717c32e586df0637be4840ed90a)) + +## [1.0.5](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.4...v1.0.5) (2023-10-09) + + +### Bug Fixes + +* push workflow ([#74](https://github.com/cloud-labs-infra/github-backup/issues/74)) ([625ba1a](https://github.com/cloud-labs-infra/github-backup/commit/625ba1a168cc18b2d553ee52aac7efab21037b73)) + ## [1.0.4](https://github.com/cloud-labs-infra/github-backup/compare/v1.0.3...v1.0.4) (2023-10-09) diff --git a/pyproject.toml b/pyproject.toml index 11b8986..dd29ede 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "backup-github-org" -version = "1.0.4" +version = "1.0.7" description = "" authors = ["Karina5005 "] readme = "README.md" @@ -27,12 +27,3 @@ build-backend = "poetry.core.masonry.api" [tool.poetry.scripts] backup-github = "backup_github.main:main" - -[tool.semantic_release] -version_variable = [ - "pyproject.toml:version" -] -branch = "main" -upload_to_pypi = true -upload_to_release = true -build_command = "pip install poetry && poetry build"