forked from flybywiresim/aircraft
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (98 loc) · 4.24 KB
/
release.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
name: release
on:
push:
tags:
- "v*"
- "!v*-rc*"
jobs:
build:
runs-on: ubuntu-latest
env:
A32NX_PRODUCTION_BUILD: 1
A32NX_INSTRUMENTS_BUILD_WORKERS: 2
STABLE_PRE_RELEASE_ID: 66067814
STABLE_PRE_RELEASE_TAG: assets/stable
STABLE_ZIP_NAME: A32NX-stable.zip
BUILD_DIR_NAME: stable
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Create .env file
run: |
echo A32NX_PRODUCTION_BUILD=1 >> .env
echo CLIENT_ID=${{ secrets.NAVIGRAPH_CLIENT_ID }} >> .env
echo CLIENT_SECRET=${{ secrets.NAVIGRAPH_CLIENT_SECRET }} >> .env
echo CHARTFOX_SECRET=${{ secrets.CHARTFOX_SECRET }} >> .env
echo SENTRY_DSN=${{ secrets.SENTRY_DSN }} >> .env
echo BUILD_DIR_NAME=${{ env.BUILD_DIR_NAME }} >> .env
echo LOCALAZY_READ_KEY=${{ secrets.LOCALAZY_READ_KEY }} >> .env
- name: Build A32NX
run: |
./scripts/dev-env/run.sh ./scripts/setup.sh
./scripts/dev-env/run.sh ./scripts/build.sh --no-tty -j 4
- name: Build ZIP file
run: |
./scripts/dev-env/run.sh node ./scripts/fragment.js
cp ./build-modules/modules.json ./flybywire-aircraft-a320-neo/install.json
./scripts/dev-env/run.sh node ./scripts/install-source.js
mkdir ./${{ env.BUILD_DIR_NAME }}
zip -r ./${{ env.BUILD_DIR_NAME }}/${{ env.STABLE_ZIP_NAME }} ./flybywire-aircraft-a320-neo/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Upload release asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.BUILD_DIR_NAME }}/${{ env.STABLE_ZIP_NAME }}
asset_name: ${{ env.STABLE_ZIP_NAME }}
asset_content_type: application/zip
- name: Upload to Bunny CDN
env:
BUNNY_BUCKET_PASSWORD: ${{ secrets.BUNNY_BUCKET_PASSWORD }}
BUNNY_SECRET_TOKEN: ${{ secrets.BUNNY_SECRET_TOKEN }}
BUNNY_BUCKET_DESTINATION: addons/a32nx/stable
run: |
./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION ./build-modules
./scripts/cdn.sh $BUNNY_BUCKET_DESTINATION ./${{ env.BUILD_DIR_NAME }}
- name: Delete old GitHub Pre-Release assets
uses: mknejp/delete-release-assets@v1
with:
token: ${{ github.token }}
tag: ${{ env.STABLE_PRE_RELEASE_TAG }}
assets: "*"
fail-if-no-assets: false
- name: Upload aicraft package to GitHub Pre-Release Assets
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ env.STABLE_PRE_RELEASE_ID }}/assets{?name,label}
asset_path: ./${{ env.BUILD_DIR_NAME }}/${{ env.STABLE_ZIP_NAME }}
asset_name: ${{ env.STABLE_ZIP_NAME }}
asset_content_type: application/zip
- name: Upload fragments to GitHub Pre-Release Assets
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
release_id: ${{ env.STABLE_PRE_RELEASE_ID }}
assets_path: ./build-modules/
- name: Update GitHub Pre-Release Body
run: |
curl --request PATCH \
--url 'https://api.github.com/repos/${{ github.repository }}/releases/${{ env.STABLE_PRE_RELEASE_ID }}' \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"body": "This pre-release has its asset updated on every release\nLast updated on ${{ env.BUILT_DATE_TIME }} from commit ${{ github.sha }}\nThis link will always point to the latest stable build: https://github.com/${{ github.repository }}/releases/download/${{ env.STABLE_PRE_RELEASE_TAG }}/${{ env.STABLE_ZIP_NAME }}"
}'