-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Action to generate a release * Register workflow * Fix script to fail * Update token permissions * Change name of checksums file * Raise error if file not downloaded * Update README
- Loading branch information
1 parent
40edcdd
commit 72bd8b6
Showing
3 changed files
with
101 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import os | ||
import requests | ||
|
||
def save_file(url: str) -> None: | ||
"""Saves a file from R2""" | ||
resp = requests.get(url, timeout=300) | ||
if resp.status_code == 200: | ||
with open(url.split("/")[-1], "wb") as file: | ||
file.write(resp.content) | ||
else: | ||
raise Exception(f"Failed to download {url} with status code {resp.status_code}") | ||
|
||
def main(): | ||
PYPY_BASE = os.environ["PYPY_BASE"] | ||
PYPY_VERSION = os.environ["PYPY_VERSION"] | ||
PYPY_BASES= PYPY_BASE.split(",") | ||
ARCHES = ["x86_64", "aarch64"] | ||
base_url= "https://pypy.cyberjake.xyz/pypy/{base}/pypy{base}-v{pypy_version}-linux-{arch}-alpine.tar.bz2" | ||
for base in PYPY_BASES: | ||
for arch in ARCHES: | ||
file_url = base_url.format( | ||
base=base, | ||
pypy_version=PYPY_VERSION, | ||
arch=arch | ||
) | ||
save_file(file_url) | ||
save_file(f"{file_url}.sig") | ||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Generate Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
pypy_base: | ||
description: 'Comma seperated base version: 2.7,3.9,3.10' | ||
required: true | ||
pypy_version: | ||
description: 'PyPy version to build: 7.3.13' | ||
required: true | ||
|
||
jobs: | ||
generate-release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
env: | ||
TAG: "${{ github.event.inputs.pypy_version }}-${{ github.event.inputs.pypy_base }}" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Release Info | ||
run: | | ||
echo "::notice title=PYPY_BASE::${{ github.event.inputs.pypy_base }}" | ||
echo "::notice title=PYPY_VERSION:: ${{ github.event.inputs.pypy_version }}" | ||
- name: Prep Release | ||
run: python .github/release.py | ||
env: | ||
PYPY_BASE: ${{ github.event.inputs.pypy_base }} | ||
PYPY_VERSION: ${{ github.event.inputs.pypy_version }} | ||
|
||
- name: Generate Checksums | ||
run: | | ||
ls -la *.tar.bz2* | ||
sha256sum *.tar.bz2 > checksums.sha256 | ||
- name: Create tag | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/${{ env.TAG }}', | ||
sha: context.sha | ||
}) | ||
- name: Release | ||
uses: crazy-max/ghaction-github-release@v2 | ||
with: | ||
draft: trues | ||
tag_name: ${{ env.TAG }} | ||
files: | | ||
*.tar.bz2 | ||
*.tar.bz2.sig | ||
checksums.sha256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters