-
Notifications
You must be signed in to change notification settings - Fork 2
71 lines (67 loc) · 2.57 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Skyblock Classic Edition - Nightly Building System
on:
push:
workflow_dispatch:
env:
MAP_NAME: Skyblock Classic Edition
MAP_NAME_SPACE: Skyblock_Classic_Edition
REPO_URL: https://github.com/Loweredgames/Skyblock-Classic-Edition
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Get version from JSON
id: get_version
run: |
import json
with open('building_version.json', 'r') as f:
data = json.load(f)
Release_Id = data.get('Release_Id', '')
Nightly_Release_Id = data.get('Nightly_Release_Id', '')
print(f"::set-output name=RELEASE::{Release_Id}")
print(f"::set-output name=NIGHTLY::{Nightly_Release_Id}")
shell: python
- name: Construct filename
id: construct_filename
run: |
filename="${{ env.MAP_NAME }}${{ steps.get_version.outputs.RELEASE }}${{ steps.get_version.outputs.NIGHTLY }}"
filename="${filename}.zip"
echo "::set-output name=zipname::$filename"
- name: Install 7zip
run: sudo apt-get install p7zip-full
- name: Zip Custom Map
run: |
7z a -r -mx9 -tzip ${{ steps.construct_filename.outputs.zipname }} . -xr!.gitignore -xr!.github -xr!.git -xr!*.zip
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ steps.construct_filename.outputs.zipname }}
path: ${{ steps.construct_filename.outputs.zipname }}
- name: Construct release name
id: construct_release_name
run: |
base_name="${{ env.MAP_NAME_SPACE }} | ${{ steps.get_version.outputs.RELEASE }}${{ steps.get_version.outputs.NIGHTLY }}"
release_name="$base_name"
echo "::set-output name=releasename::$release_name"
- name: Construct tag name
id: construct_tag
run: |
tag_name="${{ steps.get_version.outputs.RELEASE }}${{ steps.get_version.outputs.NIGHTLY }}"
echo "::set-output name=tag::$tag_name"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.construct_tag.outputs.tag }}
files: |
${{ steps.construct_filename.outputs.zipname }}
env:
GH_TOKEN: ${{ steps.get_version.outputs.RELEASE }}${{ steps.get_version.outputs.NIGHTLY }}
- name: Get Download URL
run: |
echo "${{ env.REPO_URL }}/releases/download/${{ steps.construct_tag.outputs.tag }}/${{ steps.construct_filename.outputs.zipname }}"