Added New Github Actions Workflow

- Disabled scheduled and push commands in `demomissionspacked.yml`
- Added `UpdateMoose.yml` in .github\workflows\ folder
- Added `UpdateMoose.py` in .scripts folder
This commit is contained in:
Frank
2022-10-13 23:18:04 +02:00
parent 6552e523f7
commit 82aba06cb4
3 changed files with 220 additions and 6 deletions

94
.github/workflows/UpdateMoose.yml vendored Normal file
View File

@@ -0,0 +1,94 @@
# This workflow updates the Moose.lua file in all miz files.
name: Build Demo Missions
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events for the "main" and "develop" branches
push:
branches:
- master
- develop
# Cron job every day at 2 o'clock.
schedule:
- cron: '0 2 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
name:
description: 'Manual Run'
required: false
default: 'The Octoverse'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "Update"
Update:
# Operating system
runs-on: ubuntu-latest
# Set environment variable (not used)
env:
BRANCH: main
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Say Mission branch name
- name: Mission branch
run: echo ${GITHUB_REF_NAME}
# Check if master
- name: Check if master
if: ${{ github.ref_name=='master' }}
run: echo "MOOSE_BRANCH=master" >> $GITHUB_ENV
# Check if develop
- name: Check if develop
if: ${{ github.ref_name=='develop' }}
run: echo "MOOSE_BRANCH=develop" >> $GITHUB_ENV
# Say Moose branch name.
- name: Moose branch name
run: echo $MOOSE_BRANCH
# Checks-out MOOSE_INCLUDE to ./MooseFiles
- name: Checkout MOOSE_INCLUDE
uses: actions/checkout@v3
with:
repository: FlightControl-Master/MOOSE_INCLUDE
ref: ${{ env.MOOSE_BRANCH }}
path: ./MooseFiles
# Checks-out repository to ./self
- name: Checkout Missions
uses: actions/checkout@v3
with:
#ref: ${{ env.BRANCH }}
path: ./self
# Install python
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # install the python version needed
# Run python script to update Moose.lua in all miz files
- name: Run UpdateMoose.py
run: |
cd ./self
python .scripts/UpdateMoose.py ../MooseFiles/Moose_Include_Static/ ./
# Commit changes
- name: Commit Changes
run: |
cd ./self
git add *
git config --global user.name 'funkyfranky'
git config --global user.email 'frank@inter-zone.de'
git commit -am "Updated Moose.lua" || echo "No changes to commit"
git push

View File

@@ -5,13 +5,13 @@ name: Build Demo Missions (packed)
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
schedule:
- cron: '0 7 * * 6'
#schedule:
# - cron: '0 7 * * 6'
push:
branches:
- master
- develop
#push:
# branches:
# - master
# - develop
workflow_dispatch:
inputs: