Skip to content

Commit

Permalink
Fix GitHub action warning
Browse files Browse the repository at this point in the history
Signed-off-by: Bernát Gábor <[email protected]>
  • Loading branch information
gaborbernat committed Oct 17, 2024
1 parent 2b38b35 commit 205144d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 31 deletions.
42 changes: 23 additions & 19 deletions .github/workflows/pyproject_fmt_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,20 @@ jobs:
crate: cargo-edit
- uses: actions/checkout@v4
- name: Bump version
run:
cargo set-version -p pyproject-fmt --bump '${{ github.event.inputs.release == 'no' ||
github.event.inputs.release == null && 'patch' || github.event.inputs.release }}'
run: cargo set-version -p pyproject-fmt --bump '${{ github.event.inputs.release == 'no' || github.event.inputs.release == null && 'patch' || github.event.inputs.release }}'
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: "tasks/changelog.py"
- name: Generate changelog
id: get-version
run:
uv run tasks/changelog.py pyproject-fmt "${{ github.event.number }}" "${{ github.event.pull_request.base.sha
}}"
run: uv run tasks/changelog.py pyproject-fmt "${{ github.event.number }}" "${{ github.event.pull_request.base.sha }}"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- uses: pre-commit/[email protected]
continue-on-error: true
- name: Show changes to the repository
Expand Down Expand Up @@ -106,9 +104,7 @@ jobs:

with:
target: ${{ matrix.platform.target }}
args:
-m pyproject-fmt/Cargo.toml --release --out dist --interpreter ${{ matrix.platform.interpreter || '3.8' }}
--target-dir target
args: -m pyproject-fmt/Cargo.toml --release --out dist --interpreter ${{ matrix.platform.interpreter || '3.8' }} --target-dir target
sccache: "true"
manylinux: ${{ matrix.platform.manylinux || 'auto' }}
- name: Upload wheels
Expand Down Expand Up @@ -137,9 +133,7 @@ jobs:

with:
target: ${{ matrix.platform.target }}
args:
-m pyproject-fmt/Cargo.toml --release --out dist --interpreter ${{ matrix.platform.interpreter || '3.8' }}
--target-dir target
args: -m pyproject-fmt/Cargo.toml --release --out dist --interpreter ${{ matrix.platform.interpreter || '3.8' }} --target-dir target
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -167,9 +161,7 @@ jobs:

with:
target: ${{ matrix.platform.target }}
args:
-m pyproject-fmt/Cargo.toml --release --out dist --interpreter "3.8 pypy3.8 pypy3.9 pypy3.10" --target-dir
target
args: -m pyproject-fmt/Cargo.toml --release --out dist --interpreter "3.8 pypy3.8 pypy3.9 pypy3.10" --target-dir target
sccache: "true"
- name: Upload wheels
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -206,11 +198,15 @@ jobs:
permissions:
id-token: write
contents: write
if: github.event.inputs.release != 'no' && github.event.inputs.release != null && github.ref == 'main'
needs: [linux, windows, macos, sdist, bump]
if: github.event.inputs.release != 'no' && github.event.inputs.release != null && github.ref == 'refs/heads/main'
needs: [bump, sdist, linux, macos, windows]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Download source
uses: actions/download-artifact@v4
with:
name: source
path: .
- name: Show changes to the repository
run: git diff HEAD -u
- name: Commit changes
Expand All @@ -220,11 +216,19 @@ jobs:
git commit -am "Release pyproject-fmt ${{needs.bump.outputs.version}}"
- name: Tag release
run: git tag pyproject-fmt/${{needs.bump.outputs.version}}
- name: Download wheels
uses: actions/download-artifact@v4
with:
pattern: wheels-*
path: dist
merge-multiple: "true"
- name: Show wheels
run: ls -lath dist
- name: Publish to PyPI
uses: PyO3/maturin-action@e21013af641daf9513198d98a6853760803a5c6c
with:
command: upload
args: --non-interactive --skip-existing wheels-*/*
args: --non-interactive --skip-existing dist/*
- name: Push release commit+tag and create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/target
/pyproject-fmt/.tox
/pyproject-fmt/dist
/dist
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ repos:
rev: "v3.3.3"
hooks:
- id: prettier
name: Prettier non-workflow files
args: ["--print-width=120", "--prose-wrap=always"]
exclude: ".github/workflows/"
- id: prettier
name: Prettier workflow files
args: ["--print-width=240", "--prose-wrap=always"]
exclude: "^(?!.github/workflows/)"
- repo: meta
hooks:
- id: check-hooks-apply
Expand Down
10 changes: 10 additions & 0 deletions pyproject-fmt/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
build:
os: ubuntu-lts-latest
tools:
python: "3.12"
rust: "latest"
commands:
- pip install tox-uv
- tox -c pyproject-fmt/tox.toml run -e docs -vv --notest
- tox -c pyproject-fmt/tox.toml run -e docs --skip-pkg-install --
9 changes: 0 additions & 9 deletions pyproject-fmt/.readthedocs.yml

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject-fmt/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
ver = metadata_version("pyproject-fmt")
release, version = ver, ".".join(ver.split(".")[:2])
now = datetime.now(tz=timezone.utc)
copyright = f"2022-{now.year}, {company}" # noqa: A001
project_copyright = f"2022-{now.year}, {company}"
master_doc, source_suffix = "index", ".rst"

html_theme = "furo"
Expand Down
5 changes: 3 additions & 2 deletions tasks/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Options(Namespace):

def run() -> None:
options = parse_cli()
print(options)
print(f">> {options}")
project = ROOT / options.project
changelog_file = project / "CHANGELOG.md"

Expand Down Expand Up @@ -67,7 +67,8 @@ def run() -> None:
else:
new = ""

if output := os.environ.get("GITHUB_TOKEN"):
if output := os.environ.get("GITHUB_OUTPUT"):
print(f">> GitHub output set, populating: {output}")
with Path(output).open("at+", encoding="utf-8") as file_handler:
file_handler.write(f"version={version}\n")
file_handler.write(f"changelog<<EOF\n{new}\nEOF\n")
Expand Down

0 comments on commit 205144d

Please sign in to comment.