Skip to content

Commit

Permalink
add github workflows
Browse files Browse the repository at this point in the history
move things
  • Loading branch information
deirn committed Mar 28, 2022
1 parent 1e5678a commit 0b8cee1
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 12 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build_head.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: release
on:
workflow_dispatch:
push:
branches:
- '**'
tags-ignore:
- '*.*'
pull_request:
branches:
- '**'
tags-ignore:
- '*.*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- id: vars
run: |
echo ::set-output name=VERSION::build-${GITHUB_RUN_NUMBER}-git-${GITHUB_SHA:0:7}
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: 3.x
- run: chmod +x megane
- run: ./megane bundle
env:
MOD_VERSION: ${{ steps.vars.outputs.VERSION }}
- uses : actions/upload-artifact@v2
with :
name : megane-${{ steps.vars.outputs.VERSION }}
path : |
output/*.jar
input/META-INF/jars/*.jar
31 changes: 31 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: release
on:
push:
tags: "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- id: vars
run: |
echo ::set-output name=VERSION::${GITHUB_REF#refs/*/}
- uses: actions/checkout@v2
- uses: actions/setup-python@v3
with:
python-version: 3.x
- run: chmod +x megane
- run: ./megane bundle curseforge
env:
MOD_VERSION: ${{ steps.vars.outputs.VERSION }}
CURSEFORGE_API: ${{ secrets.CURSEFORGE_API }}
- uses: alexellis/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
asset_paths: '["output/*.jar", "input/META-INF/jars/*.jar"]'
- uses : actions/upload-artifact@v2
with :
name : megane-${{ steps.vars.outputs.VERSION }}
path : |
output/*.jar
input/META-INF/jars/*.jar
8 changes: 8 additions & 0 deletions megane
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/sh

pip3 install urllib3 > /dev/null 2>&1

for arg in "$@"; do
echo "Running $arg"
python3 "./scripts/${arg}.py"
done
1 change: 0 additions & 1 deletion requirements.txt

This file was deleted.

4 changes: 2 additions & 2 deletions bundle.py → scripts/bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from inspect import cleandoc
from urllib.request import Request, urlopen
import properties as prop
from util import get_script_dir
from util import get_base_dir


mod_metadata = {
Expand Down Expand Up @@ -39,7 +39,7 @@
"jars": []
}

script_dir = get_script_dir()
script_dir = get_base_dir()
input_dir = f"{script_dir}/input"
output_dir = f"{script_dir}/output"

Expand Down
4 changes: 2 additions & 2 deletions curseforge.py → scripts/curseforge.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
from urllib3 import encode_multipart_formdata
import properties as prop
from properties import CurseForge
from util import get_script_dir
from util import get_base_dir


script_dir = get_script_dir()
script_dir = get_base_dir()

api_token = environ["CURSEFORGE_API"]
api_base_url = "https://minecraft.curseforge.com/api"
Expand Down
5 changes: 4 additions & 1 deletion properties.py → scripts/properties.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
version = "7.2.0"
from os import environ


version = environ.get("MOD_VERSION") or "local"
minecraft_version = "1.18.2"

dependencies = {
Expand Down
6 changes: 6 additions & 0 deletions scripts/util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import sys
from os.path import dirname, realpath


def get_base_dir():
return dirname(dirname(realpath(sys.argv[0])))
6 changes: 0 additions & 6 deletions util.py

This file was deleted.

0 comments on commit 0b8cee1

Please sign in to comment.