Update build.yml #74
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
fi | |
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 }}" | |
tag_name="$tag_name" | |
fi | |
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 }}" |