-
Notifications
You must be signed in to change notification settings - Fork 4
162 lines (142 loc) · 5.93 KB
/
developmissions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# This is a basic workflow that is manually triggered
name: Build Demo Missions
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
schedule:
- cron: '0 7 * * 6'
push:
branches:
- master
- develop
workflow_dispatch:
inputs:
name:
description: 'API Run'
required: false
default: 'The Octoverse'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SUPER_SECRET: ${{ secrets.APPLE_KEY }}
# 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 "greet"
build-demo-missions:
# The type of runner that the job will run on
runs-on: windows-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: pull missions
run: |
$branch = $env:GITHUB_REF -replace "refs/heads/",""
Write-Host "Build for $branch"
#Write-Host "Token: $env:GITHUB_TOKEN"
git config --global user.email "post@tniedermeier.com"
git config --global user.name "Applevangelist"
dir
git config --system core.longpaths true
git clone --depth 1 -b "$branch" https://github.com/FlightControl-Master/MOOSE_MISSIONS_UNPACKED.git .\MOOSE_MISSIONS_UNPACKED
git clone --depth 1 -b "$branch" https://github.com/FlightControl-Master/MOOSE_MISSIONS.git .\MOOSE_MISSIONS
git clone --depth 1 -b "$branch" https://github.com/FlightControl-Master/MOOSE_INCLUDE.git .\MOOSE_INCLUDE
cd MOOSE_MISSIONS
git fetch
git pull
git checkout "$branch"
cd ..\MOOSE_MISSIONS_UNPACKED
git fetch
git pull
git checkout "$branch"
cd ..
- name: Replace Moose.lua
run: |
dir
# will use the somewhat compressed Moose_.lua - so rename it
Remove-Item -Path '.\MOOSE_INCLUDE\Moose_Include_Static\Moose.lua'
Rename-Item -Path '.\MOOSE_INCLUDE\Moose_Include_Static\Moose_.lua' -NewName "Moose.lua"
# replace Moose.lua
# $Exclude=@("LICENSE","README.md","\.*")
# Get-ChildItem . -directory -exclude "$Exclude" | git rm -r $_.FullName
foreach( $file in Get-ChildItem ".\Moose_Missions_Unpacked" -Filter Moose.lua -Recurse | % { $_.FullName } )
{
Write-Host "file : $file"
Copy-Item -Path .\Moose_Include\Moose_Include_Static\Moose.lua -Destination $file
}
- name: Pack Missions
run: |
# pack missions using pack.ps1 in the directories
$curDir = Get-Location
Write-Host "Current Working Directory: $curDir"
foreach( $file in Get-ChildItem ".\Moose_Missions_Unpacked" -Filter pack.ps1 -Recurse | % { $_.FullName } )
{
Write-Host "file : $file"
. $file 2>&1
}
cd $curDir
- name: Move .miz files into MISSIONS
run: |
# move .miz files into MOOSE_MISSIONS folder
foreach( $file in Get-ChildItem ".\Moose_Missions_Unpacked" -Filter "*.miz" -Recurse | % { $_.FullName } )
{
#Write-Host "file : $file"
$to_file = $file -replace "Missions_Unpacked","Missions"
$to_parent = Split-Path -Path $to_file -Parent
$from_parent = Split-Path -Path $file -Parent
#Write-Host "todir : $to_file"
#Write-Host "fromparent : $from_parent"
#Write-Host "toparent : $to_parent"
If (!(test-path $to_parent))
{
md "$to_parent"
}
Move-Item -Path "$file" -Destination "$to_file" -Force #miz file
}
- name: Copy ps1 and lua mission files
run: |
# Copy ps1 and lua files
foreach( $file in Get-ChildItem ".\Moose_Missions_Unpacked" -Exclude "Moose.lua" -Include "*.ps1","*.lua" -Recurse | % { $_.FullName } )
{
#Write-Host "file : $file"
$to_file = $file -replace "Missions_Unpacked","Missions"
$to_parent = Split-Path -Path $to_file -Parent
$from_parent = Split-Path -Path $file -Parent
#Write-Host "todir : $to_file"
#Write-Host "fromparent : $from_parent"
#Write-Host "toparent : $to_parent"
If (!(test-path $to_parent))
{
md "$to_parent"
}
Copy-Item -Path "$file" -Destination "$to_file" -Force #ps1 and lua mission file
}
- name: Push Changes Unpacked
run: |
dir
git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://'$env:SUPER_SECRET':x-oauth-basic@github.com`n"
git config --global user.email "post@tniedermeier.com"
git config --global user.name "Applevangelist"
cd .\MOOSE_MISSIONS_UNPACKED
git add .
git commit -m "MOOSE demonstration missions [skip ci]"
git remote set-url origin https://x-access-token:"$env:SUPER_SECRET"@github.com/FlightControl-Master/MOOSE_MISSIONS_UNPACKED
git push --force-with-lease
cd ..
- name: Push Changes Packed
run: |
dir
git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://'$env:SUPER_SECRET':x-oauth-basic@github.com`n"
git config --global user.email "post@tniedermeier.com"
git config --global user.name "Applevangelist"
cd .\MOOSE_MISSIONS
git add .
git commit -m "MOOSE demonstration missions [skip ci]"
#git pull --rebase=merges
git remote set-url origin https://x-access-token:"$env:SUPER_SECRET"@github.com/FlightControl-Master/MOOSE_MISSIONS
git push -f origin
cd ..
- name: Build done
run: |
$branch = $env:GITHUB_REF -replace "refs/heads/",""
Write-Host "*****Build done for $branch"