AIRAC 2403 #41
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: release | |
on: | |
release: | |
types: [created] | |
env: | |
SITU_OWNER: 'ronyan' | |
SITU_REPOSITORY: 'VATCANSitu' | |
jobs: | |
prepare: | |
name: "🏗️ Prepare" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: olegtarasov/[email protected] | |
id: tag-name | |
- name: Get latest AeroNav data provider | |
run: curl -s http://files.aero-nav.com/AeroNav_CZWG_by_Aerosoft_NavDataPro.txt | grep -A3 'SECTOR_NAME:CZWG NAV_Data' > SectorProvider.txt | |
- id: variables | |
name: Export variables | |
run: | | |
echo "::set-output name=data_url::$( sed -n 's/SECTOR_URL://p' SectorProvider.txt )" | |
echo "::set-output name=airac_version::$( grep -Po '(?<=SECTOR_VERSION:([0-9]{14})-).[[:digit:]]+(?=-)' SectorProvider.txt | cut -c 1-4 )" | |
echo "::set-output name=airac_update_version::$( grep -Po '(?<=SECTOR_VERSION:([0-9]{14})-).[[:digit:]]+(?=-)' SectorProvider.txt | cut -c 5-6 )" | |
echo "::set-output name=situ_urls::$( cd $GITHUB_WORKSPACE/.github/workflows && python3 -c 'import os; import functions; print(functions.get_latest_release_download(os.environ["SITU_OWNER"], os.environ["SITU_REPOSITORY"]))' )" | |
outputs: | |
release_tag: ${{ steps.tag-name.outputs.tag }} | |
data_url: ${{ steps.variables.outputs.data_url }} | |
airac_version: ${{ steps.variables.outputs.airac_version }} | |
airac_update_version: ${{ steps.variables.outputs.airac_update_version }} | |
situ_urls: ${{ steps.variables.outputs.situ_urls }} | |
update-navdata: | |
name: "🔃 Update NavData" | |
needs: prepare | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download and extract sector data | |
run: | | |
curl -s -H "User-Agent: EuroScope" -o temp.7z ${{ needs.prepare.outputs.data_url }} | |
7z x temp.7z -y -o/tmp/sector-data >> /dev/null | |
rm temp.7z | |
- name: Update NavData folder | |
run: | | |
cp -TR /tmp/sector-data/CZWG/ICAO CZWG/ICAO | |
cp -TR /tmp/sector-data/CZWG/NavData CZWG/NavData | |
- name: Prepare and insert new data | |
run : | | |
# Update .sct file | |
sed -n "/\[VOR\]/,/^\s*$/p" /tmp/sector-data/*.sct >> *.sct | |
sed -n "/\[NDB\]/,/^\s*$/p" /tmp/sector-data/*.sct >> *.sct | |
sed -n "/\[FIXES\]/,/^\s*$/p" /tmp/sector-data/*.sct >> *.sct | |
sed -n "/\[HIGH AIRWAY\]/,/^\s*$/p" /tmp/sector-data/*.sct >> *.sct | |
# Update ese | |
echo -e "\n[SIDSSTARS]" >> *.ese | |
sed -n '/^\(SID:\|STAR:\)/p' /tmp/sector-data/*.ese >> *.ese | |
# Update name in [INFO] | |
gawk -i inplace '/\[INFO\]/{ n=NR+1 } NR==n{ $0="CZWG ${{ needs.prepare.outputs.airac_version }} ${{ needs.prepare.outputs.release_tag }}" }1' *.sct | |
- name: Upload sector data | |
uses: actions/upload-artifact@v2 | |
with: | |
name: sector-data | |
path: | | |
./ | |
!.git | |
latest-situ-release: | |
name: "💾 Save latest VATCAN Situ release" | |
runs-on: ubuntu-latest | |
needs: prepare | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get latest release | |
working-directory: ${{ runner.temp }} | |
run: | | |
wget ${{ needs.prepare.outputs.situ_urls }} | |
mv *.dll VATCANSitu-latest.dll | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: vatcan-situ-latest | |
path: ${{ runner.temp }}/VATCANSitu-latest.dll | |
build-situ-source: | |
name: "⚒️ Build VATCAN Situ from source" | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
repository: ${{ env.SITU_OWNER }}/${{ env.SITU_REPOSITORY }} | |
- name: Add MSBuild to PATH | |
uses: microsoft/[email protected] | |
- name: Build artifact | |
working-directory: ${{ runner.temp }} | |
run: msbuild "${env:GITHUB_WORKSPACE}\VATCANSitu.vcxproj" /p:AssemblyName=VATCANSitu-nightly /p:OutDir=${{ runner.temp }}\ | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: vatcan-situ-nightly | |
path: ${{ runner.temp }}\VATCANSitu-nightly.dll | |
package-zip: | |
name: "📦 Package zip" | |
if: ${{ always() && needs.update-navdata.result != 'failure' && needs.latest-situ-release.result != 'failure' }} | |
needs: [ prepare, update-navdata, latest-situ-release, build-situ-source ] | |
runs-on: ubuntu-latest | |
env: | |
AIRAC_VERSION: ${{ needs.prepare.outputs.airac_version }} | |
AIRAC_UPDATE_VERSION: ${{ needs.prepare.outputs.airac_update_version }} | |
RELEASE_TAG: ${{ needs.prepare.outputs.release_tag}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get sector data | |
uses: actions/download-artifact@v2 | |
with: | |
name: sector-data | |
- name: Get latest VATCAN Situ | |
uses: actions/download-artifact@v2 | |
with: | |
name: vatcan-situ-latest | |
path: CZWG\Plugins | |
- name: Get nightly VATCAN Situ | |
uses: actions/download-artifact@v2 | |
continue-on-error: true | |
with: | |
name: vatcan-situ-nightly | |
path: CZWG\Plugins | |
- name: Remove extra directories | |
run: | | |
rm -rf .git | |
rm -rf .github | |
- name: Compress files | |
env: | |
VERSION: ${{ env.AIRAC_VERSION }}_${{ env.AIRAC_UPDATE_VERSION }}_${{ env.RELEASE_TAG }} | |
run: | | |
# Full package | |
mv *.ese CZWG_Latest_"$VERSION".ese && mv *.sct CZWG_Latest_"$VERSION".sct | |
# Insert 'sector' line into profile | |
sed -i "1s/^/Settings sector \\\CZWG_Latest_$VERSION.sct\n/" *.prf | |
zip -r ${{ runner.temp }}/CZWG_Starter_"$VERSION".zip . | |
# Update package | |
rm CZWG.prf | |
rm -R CZWG/Settings | |
rm SectorFileProviderDescriptor.txt WinnipegSectorProvider.txt | |
mv *.ese CZWG_Update_"$VERSION".ese && mv *.sct CZWG_Update_"$VERSION".sct | |
zip -r ${{ runner.temp }}/CZWG_Update_"$VERSION".zip . | |
- name: Upload files to release | |
uses: shogo82148/actions-upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{runner.temp}}/*.zip | |
package-7z: | |
name: "📦 Package 7z" | |
if: ${{ always() && needs.update-navdata.result != 'failure' && needs.latest-situ-release.result != 'failure' }} | |
needs: [ prepare, update-navdata, latest-situ-release, build-situ-source ] | |
runs-on: ubuntu-latest | |
env: | |
AIRAC_VERSION: ${{ needs.prepare.outputs.airac_version }} | |
AIRAC_UPDATE_VERSION: ${{ needs.prepare.outputs.airac_update_version }} | |
RELEASE_TAG: ${{ needs.prepare.outputs.release_tag}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get sector data | |
uses: actions/download-artifact@v2 | |
with: | |
name: sector-data | |
- name: Get latest VATCAN Situ | |
uses: actions/download-artifact@v2 | |
with: | |
name: vatcan-situ-latest | |
path: CZWG\Plugins | |
- name: Get nightly VATCAN Situ | |
uses: actions/download-artifact@v2 | |
continue-on-error: true | |
with: | |
name: vatcan-situ-nightly | |
path: CZWG\Plugins | |
- name: Remove extra directories | |
run: | | |
rm -rf .git | |
rm -rf .github | |
- name: Compress files | |
env: | |
VERSION: ${{ env.AIRAC_VERSION }}_${{ env.AIRAC_UPDATE_VERSION }}_${{ env.RELEASE_TAG }} | |
run: | | |
# Full package | |
mv *.ese CZWG_Latest_"$VERSION".ese && mv *.sct CZWG_Latest_"$VERSION".sct | |
# Insert 'sector' line into profile | |
sed -i "1s/^/Settings sector \\\CZWG_Latest_$VERSION.sct\n/" *.prf | |
7z a -mm=LZMA -xr!CZWG/Sounds ${{ runner.temp }}/CZWG_Starter_"$VERSION".7z * | |
7z a -mx=0 ${{ runner.temp }}/CZWG_Starter_"$VERSION".7z CZWG/Sounds | |
# Update package | |
rm CZWG.prf | |
rm -R CZWG/Settings | |
rm SectorFileProviderDescriptor.txt WinnipegSectorProvider.txt | |
mv *.ese CZWG_Update_"$VERSION".ese && mv *.sct CZWG_Update_"$VERSION".sct | |
7z a -mm=LZMA -xr!CZWG/Sounds ${{ runner.temp }}/CZWG_Update_"$VERSION".7z * | |
7z a -mx=0 ${{ runner.temp }}/CZWG_Update_"$VERSION".7z CZWG/Sounds | |
- name: Upload files to release | |
uses: shogo82148/actions-upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{runner.temp}}/*.7z | |
cleanup: | |
name: "🧹 Cleanup" | |
if: ${{ always() }} | |
needs: [ package-zip, package-7z ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clean artifacts | |
uses: geekyeggo/delete-artifact@v1 | |
with: | |
name: | | |
sector-data | |
vatcan-situ-latest | |
vatcan-situ-nightly |