Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the action (maybe) #43

Merged
merged 3 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/create-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: "📥 Checkout"
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: "✏️ Generate release changelog"
id: generate-release-changelog
uses: heinrichreimer/github-changelog-generator-action@v2.3
uses: heinrichreimer/github-changelog-generator-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
onlyLastTag: "true"
Expand Down
71 changes: 30 additions & 41 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,51 @@ name: Handle Pull Request
on:
pull_request:
types: [opened, ready_for_review]

env:
SITU_OWNER: 'ronyan'
SITU_REPOSITORY: 'VATCANSitu'
SITU_OWNER: "ronyan"
SITU_REPOSITORY: "VATCANSitu"

jobs:
add-reviewers:
name: "🤖 Auto assign PR reviewers"
runs-on: ubuntu-latest

steps:
- name: "Assign 'sector-file-team' to PR"
uses: rowi1de/[email protected]
with:
repo-token: ${{ secrets.REVIEW_TOKEN }}
teams: "sector-file-team"

prepare:
name: "🏗️ Prepare"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- 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 "data_url=$( sed -n 's/SECTOR_URL://p' SectorProvider.txt )" >> $GITHUB_ENV
echo "airac_version=$( grep -Po '(?<=SECTOR_VERSION:([0-9]{14})-).[[:digit:]]+(?=-)' SectorProvider.txt | cut -c 1-4 )" >> $GITHUB_ENV
echo "airac_update_version=$( grep -Po '(?<=SECTOR_VERSION:([0-9]{14})-).[[:digit:]]+(?=-)' SectorProvider.txt | cut -c 5-6 )" >> $GITHUB_ENV

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"]))' )"
echo "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"]))' )" >> $GITHUB_ENV

outputs:
release_tag: PR-TESTING
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 }}
data_url: ${{ env.data_url }}
airac_version: ${{ env.airac_version }}
airac_update_version: ${{ env.airac_update_version }}
situ_urls: ${{ env.situ_urls }}

update-navdata:
name: "🔃 Update NavData"
needs: prepare
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- 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
7z x temp.7z -y -o /tmp/sector-data
rm temp.7z

- name: Update NavData folder
Expand All @@ -66,7 +55,7 @@ jobs:
cp -TR /tmp/sector-data/CZWG/NavData CZWG/NavData

- name: Prepare and insert new data
run : |
run: |
# Update .sct file
sed -n "/\[VOR\]/,/^\s*$/p" /tmp/sector-data/*.sct >> *.sct
sed -n "/\[NDB\]/,/^\s*$/p" /tmp/sector-data/*.sct >> *.sct
Expand All @@ -81,7 +70,7 @@ jobs:
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
uses: actions/upload-artifact@v4
with:
name: sector-data
path: |
Expand All @@ -94,7 +83,7 @@ jobs:
needs: prepare

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Get latest release
working-directory: ${{ runner.temp }}
Expand All @@ -103,15 +92,15 @@ jobs:
mv *.dll VATCANSitu-latest.dll

- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: vatcan-situ-latest
path: ${{ runner.temp }}/VATCANSitu-latest.dll

package:
name: "📦 Package"
if: ${{ always() && needs.update-navdata.result != 'failure' && needs.latest-situ-release.result != 'failure' }}
needs: [ prepare, update-navdata, latest-situ-release ]
needs: [prepare, update-navdata, latest-situ-release]
runs-on: ubuntu-latest

env:
Expand All @@ -120,15 +109,15 @@ jobs:
RELEASE_TAG: ${{ needs.prepare.outputs.release_tag}}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Get sector data
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: sector-data

- name: Get latest VATCAN Situ
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: vatcan-situ-latest
path: CZWG\Plugins
Expand All @@ -139,31 +128,31 @@ jobs:
rm -rf .github

- name: Compress files
env:
env:
VERSION: ${{ env.AIRAC_VERSION }}_${{ env.AIRAC_UPDATE_VERSION }}_${{ env.RELEASE_TAG }}
run: |
mv *.ese CZWG_Full_"$VERSION".ese && mv *.sct CZWG_Full_"$VERSION".sct

# Insert 'sector' line into profile
sed -i "1s/^/Settings sector \\CZWG_Full_$VERSION.sct\n/" *.prf

zip -r ${{ runner.temp }}/CZWG_Full_"$VERSION".zip .

- name: Upload workflow artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Testing File
path: ${{ runner.temp }}/CZWG_Full_${{ env.AIRAC_VERSION }}_${{ env.AIRAC_UPDATE_VERSION }}_${{ env.RELEASE_TAG }}.zip

cleanup:
name: "🧹 Cleanup"
if: ${{ always() }}
needs: [ package ]
needs: [package]
runs-on: ubuntu-latest

steps:
- name: Clean artifacts
uses: geekyeggo/delete-artifact@v1
uses: geekyeggo/delete-artifact@v5
with:
name: |
sector-data
Expand Down
Loading
Loading