Fix 95df7ea: Incorrect WindowClasses for deduplicated window descs. (#13412)
[openttd-github.git] / .github / workflows / upload-cdn.yml
blob91c5a165cf2fc1fde6f899d44c314a1e9893d7f1
1 name: Upload (CDN)
3 on:
4   workflow_call:
5     inputs:
6       version:
7         required: true
8         type: string
9       folder:
10         required: true
11         type: string
12       trigger_type:
13         required: true
14         type: string
16 jobs:
17   prepare:
18     name: Prepare
20     runs-on: ubuntu-latest
22     steps:
23     - name: Download all bundles
24       uses: actions/download-artifact@v4
26     - name: Calculate checksums
27       run: |
28         echo "::group::Move bundles to a single folder"
29         mkdir bundles
30         mv openttd-*/* bundles/
31         echo "::endgroup::"
33         cd bundles
34         for i in $(ls openttd-*); do
35           echo "::group::Calculating checksums for ${i}"
36           openssl dgst -r -md5 -hex $i > $i.md5sum
37           openssl dgst -r -sha1 -hex $i > $i.sha1sum
38           openssl dgst -r -sha256 -hex $i > $i.sha256sum
39           echo "::endgroup::"
40         done
42         # Some targets generate files that are meant for our-eyes-only.
43         # They are stored in the "internal" folder, and contains bundles
44         # for targets like Windows Store. No user has a benefit of knowing
45         # they exist, hence: internal.
46         if [ -e internal ]; then
47           cd internal
48           for i in $(ls openttd-*); do
49             echo "::group::Calculating checksums for ${i}"
50             openssl dgst -r -md5 -hex $i > $i.md5sum
51             openssl dgst -r -sha1 -hex $i > $i.sha1sum
52             openssl dgst -r -sha256 -hex $i > $i.sha256sum
53             echo "::endgroup::"
54           done
55         fi
57     - name: Merge symbols
58       run: |
59         mkdir symbols
60         cp -R symbols-*/* symbols/
62         # Compress all files as gzip, to reduce cost of storage on the CDN.
63         for i in $(find symbols -mindepth 2 -type f); do
64           gzip ${i}
65         done
67         # Leave a mark in each folder what version actually created the symbol file.
68         for i in $(find symbols -mindepth 2 -type d); do
69           touch ${i}/.${{ inputs.version }}.txt
70         done
72     - name: Store bundles
73       uses: actions/upload-artifact@v4
74       with:
75         name: cdn-bundles
76         path: bundles/*
77         retention-days: 5
79     - name: Store breakpad symbols
80       uses: actions/upload-artifact@v4
81       with:
82         name: cdn-symbols
83         path: symbols/*
84         retention-days: 5
86   publish-bundles:
87     needs:
88     - prepare
90     name: Publish bundles
91     uses: OpenTTD/actions/.github/workflows/rw-cdn-upload.yml@v5
92     secrets:
93       CDN_SIGNING_KEY: ${{ secrets.CDN_SIGNING_KEY }}
94       DEPLOYMENT_APP_ID: ${{ secrets.DEPLOYMENT_APP_ID }}
95       DEPLOYMENT_APP_PRIVATE_KEY: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }}
96     with:
97       artifact-name: cdn-bundles
98       folder: ${{ inputs.folder }}
99       version: ${{ inputs.version }}
101   publish-symbols:
102     needs:
103     - prepare
105     name: Publish symbols
106     uses: OpenTTD/actions/.github/workflows/rw-symbols-upload.yml@v5
107     secrets:
108       SYMBOLS_SIGNING_KEY: ${{ secrets.SYMBOLS_SIGNING_KEY }}
109     with:
110       artifact-name: cdn-symbols
111       repository: OpenTTD
113   docs:
114     if: ${{ inputs.trigger_type == 'new-master' }}
115     needs:
116     - publish-bundles
118     name: Publish docs
120     runs-on: ubuntu-latest
122     steps:
123     - name: Generate access token
124       id: generate_token
125       uses: tibdex/github-app-token@v2
126       with:
127         app_id: ${{ secrets.DEPLOYMENT_APP_ID }}
128         private_key: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }}
129         installation_retrieval_mode: "repository"
130         installation_retrieval_payload: "OpenTTD/workflows"
132     - name: Trigger 'Publish Docs'
133       uses: peter-evans/repository-dispatch@v3
134       with:
135         token: ${{ steps.generate_token.outputs.token }}
136         repository: OpenTTD/workflows
137         event-type: publish-docs
138         client-payload: '{"version": "${{ inputs.version }}", "folder": "${{ inputs.folder }}"}'