Skip to content

Commit cf777ab

Browse files
committed
build automatically using workflows
1 parent df49f52 commit cf777ab

File tree

3 files changed

+88
-0
lines changed

3 files changed

+88
-0
lines changed

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- "[0-9]+.[0-9]+.[0-9]*"
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
- name: Set env
16+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
17+
- name: Set up Python
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: 3.8
21+
- name: Install dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install git+https://github.com/inettgmbh/python-mkp.git@0.6
25+
- name: Build
26+
run: |
27+
chmod +x build/mkp-pack build/update-version
28+
build/update-version ${{ env.RELEASE_VERSION }}
29+
build/mkp-pack
30+
- name: Create Release
31+
id: create_release
32+
uses: actions/create-release@v1
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
with:
36+
tag_name: ${{ github.ref }}
37+
release_name: Release ${{ github.ref }}
38+
draft: false
39+
prerelease: false
40+
- name: Upload a Build Artifact
41+
uses: actions/upload-artifact@v2.2.3
42+
with:
43+
# Artifact name
44+
name: mkp-package
45+
# A file, directory or wildcard pattern that describes what to upload
46+
path: "*.mkp"
47+
# The desired behavior if no files are found using the provided path.
48+
- name: Upload Release Asset
49+
id: upload-release-asset
50+
uses: actions/upload-release-asset@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
upload_url: ${{ steps.create_release.outputs.upload_url }}
55+
asset_path: proxmox_bs-${{ env.RELEASE_VERSION }}.mkp
56+
asset_name: proxmox_bs-${{ env.RELEASE_VERSION }}.mkp
57+
asset_content_type: application/gzip

build/mkp-pack

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env python3
2+
3+
from sys import argv
4+
import mkp
5+
import ast
6+
7+
# read info file
8+
f_info = open("info", "r")
9+
info = ast.literal_eval(f_info.read())
10+
f_info.close()
11+
12+
mkp.pack_to_file(info, '.', "%s-%s.mkp" % (info['name'], info['version']))
13+

build/update-version

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env python3
2+
3+
from sys import argv
4+
import ast
5+
import pprint
6+
7+
# read info file
8+
f_info = open("info", "r")
9+
info = ast.literal_eval(f_info.read())
10+
info['version'] = argv[1]
11+
f_info.close()
12+
13+
# write info file
14+
f_info = open("info", "w")
15+
pprint.pprint(info, stream=f_info)
16+
#f_info.write(pprint.saferepr(package.info))
17+
f_info.close()
18+

0 commit comments

Comments
 (0)