-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
123 lines (121 loc) · 4.97 KB
/
Copy pathpr-upload.yml
File metadata and controls
123 lines (121 loc) · 4.97 KB
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
name: Upload PR for Installer QA
on:
workflow_run:
workflows: ['PR Tests & Build (FS2020)', 'PR Tests & Build (FS2024)']
types:
- completed
jobs:
upload-pr:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Upload PR for Installer QA
env:
BUILD_SUFFIX: ${{ contains(github.event.workflow_run.name, 'FS2020') && '-4k' || '' }}
permissions:
contents: read
actions: read
pull-requests: read
steps:
- name: Maximize space
uses: AdityaGarg8/remove-unwanted-software@v4.1
with:
remove-android: 'true'
remove-dotnet: 'true'
remove-haskell: 'true'
remove-codeql: 'true'
remove-large-packages: 'true'
remove-cached-tools: 'true'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y rclone
- name: Download PR metadata
uses: actions/download-artifact@v5
with:
name: pr-metadata
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Load PR info
id: pr
run: |
PR_NUMBER=$(jq -r '.number' pr.json)
PR_TITLE=$(jq -r '.title' pr.json)
PR_BODY=$(jq -r '.body // ""' pr.json)
{
echo "number=$PR_NUMBER"
echo "title=$PR_TITLE"
echo "body<<EOF"
echo "$PR_BODY"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Checkout trusted source
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ github.event.repository.default_branch }}
- name: Download PR artifacts
uses: actions/download-artifact@v5
with:
pattern: build-modules-*
path: /tmp/artifacts/
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
continue-on-error: true
- name: Check artifacts
id: artifacts
run: |
if [ -d "/tmp/artifacts" ] && [ "$(ls -A /tmp/artifacts)" ]; then
echo "found=true" >> $GITHUB_OUTPUT
else
echo "found=false" >> $GITHUB_OUTPUT
fi
- name: Configure rclone for Cloudflare R2
if: steps.artifacts.outputs.found == 'true'
run: |
mkdir -p ~/.config/rclone
cat > ~/.config/rclone/rclone.conf <<EOF
[cloudflare-r2]
type = s3
provider = Cloudflare
env_auth = false
access_key_id = ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
secret_access_key = ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
endpoint = ${{ secrets.CLOUDFLARE_R2_ENDPOINT }}
region = auto
EOF
- name: Upload A32NX to CloudFlare CDN (Installer)
if: steps.artifacts.outputs.found == 'true'
env:
CLOUDFLARE_CDN_ZONE_ID: ${{ secrets.CLOUDFLARE_CDN_ZONE_ID }}
CLOUDFLARE_PURGE_TOKEN: ${{ secrets.CLOUDFLARE_PURGE_TOKEN }}
CDN_BUCKET_DESTINATION: addons/${{ contains(github.event.workflow_run.name, 'FS2024') && 'msfs2024' || 'msfs2020' }}/a32nx/pr-${{ steps.pr.outputs.number }}
run: |
./scripts/cf-cdn.sh /tmp/artifacts/build-modules-a32nx $CDN_BUCKET_DESTINATION
- name: Upload A380X to CloudFlare CDN (Installer)
if: steps.artifacts.outputs.found == 'true'
env:
CLOUDFLARE_CDN_ZONE_ID: ${{ secrets.CLOUDFLARE_CDN_ZONE_ID }}
CLOUDFLARE_PURGE_TOKEN: ${{ secrets.CLOUDFLARE_PURGE_TOKEN }}
CDN_BUCKET_DESTINATION: addons/${{ contains(github.event.workflow_run.name, 'FS2024') && 'msfs2024' || 'msfs2020' }}/a380x/pr-${{ steps.pr.outputs.number }}${{ env.BUILD_SUFFIX }}
run: |
./scripts/cf-cdn.sh /tmp/artifacts/build-modules-a380x${{ env.BUILD_SUFFIX }} $CDN_BUCKET_DESTINATION
- name: Lock QA config
if: steps.artifacts.outputs.found == 'true'
run: ./scripts/acquire_lock.sh installer/qa-config/.lock
- name: Add QA config entry
if: steps.artifacts.outputs.found == 'true'
env:
PR_NUMBER: ${{ steps.pr.outputs.number }}
PR_TITLE: ${{ steps.pr.outputs.title }}
PR_BODY: ${{ steps.pr.outputs.body }}
ADDON_KEYS: ${{ contains(github.event.workflow_run.name, 'FS2024') && 'a32nx-msfs2024,a380x-msfs2024' || 'a32nx-msfs2020,a380x-msfs2020' }}
TEXTURE_QUALITY: ${{ contains(github.event.workflow_run.name, 'FS2020') && '4k' || '' }}
CLOUDFLARE_CDN_ZONE_ID: ${{ secrets.CLOUDFLARE_CDN_ZONE_ID }}
CLOUDFLARE_PURGE_TOKEN: ${{ secrets.CLOUDFLARE_PURGE_TOKEN }}
CDN_BUCKET_DESTINATION: installer/qa-config/
run: |
node ./scripts/add_qa_config.js
./scripts/cf-cdn.sh ./qa-config $CDN_BUCKET_DESTINATION
- name: Release QA config lock
if: always()
run: ./scripts/release_lock.sh installer/qa-config/.lock