Skip to content

Commit

Permalink
Merge pull request #234 from macisamuele/maci-bump-github-actions
Browse files Browse the repository at this point in the history
GitHub actions: fix and bump
  • Loading branch information
macisamuele authored Jul 13, 2024
2 parents a1690c6 + 30e5e2a commit 7758c1b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]

golang_version: [1.22.1]
java_version: ['15', '21']
golang_version: [1.22.5]
java_version: ['21']
python_version: ['3.8', '3.10', '3.12']
rust_version: [stable]

Expand All @@ -41,9 +41,7 @@ jobs:
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust_version }}
override: true
components: rustfmt
- name: Setup Java
uses: actions/setup-java@v4
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/bump-releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ jobs:
- name: Create Pull Request
id: cpr
if: ${{ env.GIT_SHA != github.sha }}
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.REPO_TOKEN }}
title: '[Automated PR] Bump KTLint and/or Google Java Formatter'
title: '[Automated PR] Bump external tools (KTLint, Google Java Formatter, ktfmt, Pantlir)'
body: |
Bump KTLint and/or Google Java Formatter
*Auto-generated* by [bump-releases](https://github.com/macisamuele/language-formatters-pre-commit-hooks/actions/workflows/bump-releases.yaml)
reviewers: cortinico,macisamuele
reviewers: macisamuele
branch: create-pull-request/bump-releases
delete-branch: true
draft: false
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/bump_external_releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@


def bump_release(github_project, tool_name):
print(f"Checking for {tool_name} updates")
try:
with urlopen(f"https://api.github.com/repos/{github_project}/releases/latest") as request: # nosec: disable=B310
latest_version = json.load(request)["name"].lstrip("v")
latest_version = json.load(request)["tag_name"].lstrip("v")
except: # noqa: E722 (allow usage of bare 'except')
traceback.print_exc()
return False
Expand All @@ -23,14 +24,14 @@ def bump_release(github_project, tool_name):
with tool_name_version_path.open(mode="r") as f:
default_version = f.readline().split()[0]

print(f"Latest version: {latest_version}, repository version: {default_version}")
if default_version == latest_version:
return False

with tool_name_version_path.open(mode="w") as f:
f.write(f"{latest_version}\n")

message = f"Bump {tool_name} to version {latest_version}"
print(message)
message = f"Bump {tool_name}: {default_version} => {latest_version}"

def call(*args):
print(f"Executing: {args}")
Expand Down Expand Up @@ -71,7 +72,7 @@ def bump_google_java_formatter():
def bump_palantir_java_formatter():
return bump_release(
github_project="jsonschema2dataclass/palantir-cli",
tool_name="palantir-cli",
tool_name="palantir",
)


Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
- name: Create a Wheel file and source distribution
run: python setup.py sdist bdist_wheel
- name: Publish distribution package to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_password }}

0 comments on commit 7758c1b

Please sign in to comment.