diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..8e161da --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: ['https://afdian.net/a/ssttkkl'] diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..27bcee3 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,4 @@ +template: | + ## What’s Changed + + $CHANGES diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml new file mode 100644 index 0000000..6ca3d81 --- /dev/null +++ b/.github/workflows/pr-check.yml @@ -0,0 +1,64 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: PR Check + +on: + pull_request: + +jobs: + test-api-only: + + strategy: + fail-fast: false + matrix: + os: [ macos-latest, windows-latest, ubuntu-latest ] + python-version: ["3.9", "3.10", "3.11", "3.12"] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install requirements + run: | + pip install poetry + poetry export --with=dev --without-hashes -o requirements.txt + pip install -r requirements.txt + - name: Test with pytest + run: pytest + +# test-full: +# +# strategy: +# fail-fast: false +# matrix: +# os: [ macos-latest, windows-latest, ubuntu-latest ] +# python-version: ["3.9", "3.10", "3.11", "3.12"] +# +# runs-on: ${{ matrix.os }} +# steps: +# - name: Checkout nonebot-plugin-access-control +# uses: actions/checkout@v3 +# with: +# repository: 'bot-ssttkkl/nonebot-plugin-access-control' +# - name: Set up Python ${{ matrix.python-version }} +# uses: actions/setup-python@v3 +# with: +# python-version: ${{ matrix.python-version }} +# - name: Install requirements +# run: | +# pip install poetry +# poetry export --with=dev --without-hashes -o requirements.txt +# pip install -r requirements.txt +# - name: Checkout nonebot-plugin-access-control-api +# uses: actions/checkout@v3 +# with: +# path: 'nonebot-plugin-access-control-api' +# - name: Install nonebot-plugin-access-control-api +# run: | +# pip install ./nonebot-plugin-access-control-api +# - name: Test with pytest +# run: pytest ./src/tests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4d0d13d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,54 @@ +name: Release + +on: + push: + tags: + - v* + +jobs: + publish-pypi-github: + runs-on: ubuntu-latest + environment: + name: release + url: https://pypi.org/p/nonebot-plugin-access-control + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + # write permission is required to create a github release + contents: write + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: write + + steps: + - uses: actions/checkout@v3 + + - name: Setup Python environment + uses: actions/setup-python@v3 + with: + python-version: "3.11" + + - name: Setup Poetry + run: | + pip install poetry + + - run: | + echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - uses: release-drafter/release-drafter@v5 + with: + name: Release ${{ env.TAG_NAME }} + tag: ${{ env.TAG_NAME }} + publish: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish PyPI and Github + run: | + poetry build + ls dist/ + gh release upload --clobber ${{ env.TAG_NAME }} dist/*.tar.gz dist/*.whl + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Publish pypi + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file