Skip to content

Commit

Permalink
Generate releases (#8)
Browse files Browse the repository at this point in the history
* 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
Cyb3r-Jak3 authored Oct 6, 2023
1 parent 40edcdd commit 72bd8b6
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 11 deletions.
30 changes: 30 additions & 0 deletions .github/release.py
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()
58 changes: 58 additions & 0 deletions .github/workflows/generate-release.yml
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
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,18 @@ PyPy: 3.9-7.3.11 is `https://pypy.cyberjake.xyz/pypy/3.9/pypy3.9-v7.3.11-linux-x

### Available Versions

| PyPy Base | PyPy Version | Alpine Version | Arch |
|:-----------:|:--------------:|:----------------:|:------------------:|
| 3.10 | 7.3.13 | 3.18 | x86_64 & aarch64 |
| 3.9 | 7.3.13 | 3.18 | x86_64 & aarch64 |
| 2.7 | 7.3.13 | 3.18 | x86_64 & aarch64 |
| 3.10 | 7.3.12 | 3.18 | x86_64 & aarch64 |
| 3.9 | 7.3.12 | 3.18 | x86_64 & aarch64 |
| 2.7 | 7.3.12 | 3.18 | x86_64 & aarch64 |
| 3.9 | 7.3.11 | 3.17 | x86_64 & aarch64 |
| 3.8 | 7.3.11 | 3.17 | x86_64 & aarch64 |
| 2.7 | 7.3.11 | 3.17 | x86_64 & aarch64 |
| PyPy Base | PyPy Version | Alpine Version | Arch |
|-----------|----------------|----------------|------------------|
| 3.10 | 7.3.12, 7.3.13 | 3.18 | x86_64 & aarch64 |
| 3.9 | 7.3.12, 7.3.13 | 3.18 | x86_64 & aarch64 |
| 2.7 | 7.3.12, 7.3.13 | 3.18 | x86_64 & aarch64 |
| 3.9 | 7.3.11 | 3.17 | x86_64 & aarch64 |
| 3.8 | 7.3.11 | 3.17 | x86_64 & aarch64 |
| 2.7 | 7.3.11 | 3.17 | x86_64 & aarch64 |

Please make an issue if you want to see a specific version.


### GitHub Release

Starting with pypy 7.3.13, you can download pypy builds under the [releases](https://github.com/Cyb3r-Jak3/docker-alpine-pypy/releases) section.

0 comments on commit 72bd8b6

Please sign in to comment.