{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from fastcore.utils import *\n", "from ghapi import *\n", "import tarfile,pprint" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "tag = 'v0.79.0'\n", "api = GhApi(owner='fastai', repo='hugo-mathjax', token=github_token())\n", "rel = api.repos.get_release_by_tag(tag)\n", "api.delete_release(rel)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from fastcore.utils import *\n", "from ghapi import *\n", "import tarfile\n", "\n", "def rel_tag():\n", " api = GhApi(owner='fastai', repo='hugo-mathjax', token=github_token())\n", " tag = GhApi().repos.get_latest_release('gohugoio', repo='hugo').name\n", " try: return api.repos.get_release_by_tag(tag)\n", " except HTTP404NotFoundError: pass\n", "\n", " rel = api.repos.create_release(tag, name=tag)\n", " actions_output('tag', tag)\n", "\n", "# rel_tag()" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'step1': {'outputs': {'action_fruit': 'strawberry'},\n", " 'outcome': 'success',\n", " 'conclusion': 'success'}}" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "github_needs = urljson('https://raw.githubusercontent.com/fastai/ghapi/master/examples/needs.json?')\n", "out = loads(nested_idx(github_needs, 'prebuild', 'outputs', 'out')); out" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "tag = nested_idx(out, 'step1', 'outputs', 'tag'); tag" ] }, { "cell_type": "code", "execution_count": 59, "metadata": {}, "outputs": [], "source": [ "# os.chdir('..')\n", "\n", "platform = dict(linux='linux', linux2='linux', win32='win', darwin='mac')[sys.platform]\n", "out = loads(nested_idx(github_needs, 'prebuild', 'outputs', 'out'))\n", "tag = nested_idx(out, 'step1', 'outputs', 'tag')\n", "\n", "rel = GhApi().repos.get_release_by_tag(owner='gohugoio', repo='hugo', tag=tag)\n", "print(rel.tarball_url)\n", "with urlopen(rel.tarball_url) as f: untar_dir(f, repo)\n", "os.chdir('hugo')\n", "run(f'patch -l -p1 -i ../hugo.patch')\n", "run('go build')# --tags extended')\n", "ext_nm = 'hugo.exe' if platform=='win' else 'hugo'\n", "fn = f'hugo-{platform}.tgz'\n", "with tarfile.open(fn, \"w:gz\") as tar: tar.add(ext_nm)\n", "\n", "api = GhApi(owner='fastai', repo='hugo-mathjax', token=github_token())\n", "rel = api.repos.get_release_by_tag(tag)\n", "api.upload_file(rel, fn)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.7" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": false, "sideBar": true, "skip_h1_title": true, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }