Update build.yml #87
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 }}" | |
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 | |
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 nightly release name | |
run: | | |
tag_name="${{ steps.get_version.outputs.NIGHTLY_TAG }}" | |
get_tag_name="$tag_name" | |
echo "::set-output name=tag::$tag_name" | |
- 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 }}" |