Skip to content

Commit

Permalink
Fix release
Browse files Browse the repository at this point in the history
  • Loading branch information
Sleitnick committed Jan 13, 2025
1 parent e8e7719 commit fc38929
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
python-version: "3.x"

- name: Check tag version against cargo version
run: python check_version.py ${{ github.ref_name }}
run: python scripts/check_version.py ${{ github.ref_name }}

build:
needs: ["check-release-version"]
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Upload Archive to Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.BIN }}-${{ env.PROJECT_VERSION }}-${{ matrix.label }}.zip
name: ${{ env.BIN }}-${{ env.PROJECT_VERSION }}-${{ matrix.label }}
path: release.zip

create-release:
Expand All @@ -106,12 +106,16 @@ jobs:
with:
path: gh_artifacts

- name: Move releases
run: python -u scripts/move_releases.py gh_artifacts

- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
fail_on_unmatched_files: true
files: gh_artifacts/*.zip

publish:
Expand Down
File renamed without changes.
48 changes: 48 additions & 0 deletions scripts/move_releases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import sys
import os


def main():
args = sys.argv
n_args = len(args)
if n_args <= 1:
print("no path argument found", file=sys.stderr)
exit(1)

path = args[1]

expected = 0
total = 0

for child_path in os.listdir(path):
filepath = os.path.join(path, child_path)

if not os.path.isdir(filepath):
print(f"{filepath} is not a dir")
continue

expected += 1

release_filepath = os.path.join(filepath, "release.zip")
if not os.path.isfile(release_filepath):
print(f"no release.zip file found in {filepath}", file=sys.stderr)
continue

target_filepath = f"{filepath}.zip"
os.rename(release_filepath, target_filepath)

total += 1
print(target_filepath)

if total < expected:
print(f"{total}/{expected} succeeded [{total - expected} failed]", file=sys.stderr)
exit(1)
elif total == 0:
print("no work", file=sys.stderr)
exit(1)

print("done")


if __name__ == "__main__":
main()

0 comments on commit fc38929

Please sign in to comment.