Create Release #13
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: Create Release | |
on: | |
workflow_dispatch: | |
inputs: | |
env: | |
type: choice | |
description: Environment (release, preview) | |
options: | |
- release | |
- preview | |
required: true | |
version: | |
description: 'Release Version' | |
required: true | |
jobs: | |
build_ui: | |
name: Build UI | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: 7 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
working-directory: './WebUI' | |
run: pnpm install --frozen-lockfile | |
- name: Build | |
working-directory: './WebUI' | |
run: | | |
$env:VERSION='${{ github.event.inputs.version }}' | |
pnpm build | |
- name: Upload WebUI Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: webui-build | |
retention-days: 1 | |
path: ui.vuic | |
build_lua: | |
name: Build Lua | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Rename Config .release files | |
run: | | |
mv ./ext/Shared/Config.release.lua ./ext/Shared/Config.lua | |
# - name: Rename mod.json | |
# run: | | |
# mv ./mod.release.json ./mod.json | |
- name: Update version in mod.json | |
run: | | |
sed -i '/"Version": "0.0.0"/s/"0.0.0"/"${{ github.event.inputs.version }}"/' mod.json | |
- name: Upload Lua Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: lua-build | |
retention-days: 1 | |
path: | | |
ext | |
mod.json | |
publish: | |
name: Publish Release | |
runs-on: ubuntu-latest | |
needs: [build_ui, build_lua] | |
steps: | |
- name: Download WebUI Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: webui-build | |
- name: Download Lua Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: lua-build | |
- name: Create Zip File | |
run: | | |
zip -r MapEditor.zip . | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.version }} | |
release_name: ${{ github.event.inputs.version }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./MapEditor.zip | |
asset_name: MapEditor.zip | |
asset_content_type: application/zip | |
- name: Delete zip file | |
run: rm MapEditor.zip | |
- name: Publish to VUMM as tag ${{ github.event.inputs.env }} | |
if: ${{ github.event.inputs.env != 'release' }} | |
uses: BF3RM/vumm-action@v1 | |
env: | |
VUMM_TOKEN: ${{ secrets.VUMM_TOKEN }} | |
with: | |
tag: ${{ github.event.inputs.env }} | |
- name: Publish to VUMM as latest | |
if: ${{ github.event.inputs.env == 'release' }} | |
uses: BF3RM/vumm-action@v1 | |
env: | |
VUMM_TOKEN: ${{ secrets.VUMM_TOKEN }} |