Update build.yml #89
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', '') | |
Nightly_Github_Tag = data.get('Nightly_Github_Tag', '') | |
print(f"::set-output name=RELEASE::{Release_Id}") | |
print(f"::set-output name=NIGHTLY::{Nightly_Release_Id}") | |
print(f"::set-output name=NIGHTLY_TAG::{Nightly_Github_Tag}") | |
shell: python | |
- name: Construct filename | |
id: construct_filename | |
run: | | |
filename="${{ env.MAP_NAME }}${{ steps.get_version.outputs.RELEASE }}${{ steps.get_version.outputs.NIGHTLY }}" | |
if [[ -n "${{ steps.get_version.outputs.NIGHTLY_TAG }}" ]]; then | |
filename="${filename}_${{ steps.get_version.outputs.NIGHTLY_TAG }}" | |
fi | |
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 tag name | |
run: | | |
tag_name="${{ steps.get_version.outputs.NIGHTLY_TAG }} | |
tag_name="NIGHTLYTEST_${{ steps.get_version.outputs.NIGHTLY_TAG }}" | |
fi | |
echo "::set-output name=tag::$NIGHTLY_TAG" | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.get_version.outputs.NIGHTLY_TAG }} | |
files: | | |
${{ steps.construct_filename.outputs.zipname }} | |
env: | |
GH_TOKEN: ${{ steps.get_version.outputs.RELEASE }}${{ steps.get_version.outputs.NIGHTLY_TAG }} | |
- name: Get Download URL | |
run: | | |
echo "${{ env.REPO_URL }}/releases/download/${{ steps.get_version.outputs.NIGHTLY_TAG }}/${{ steps.construct_filename.outputs.zipname }}" |