Files @ r28566:ec28e66fe6ee
Branch filter:

Location: cpp/openttd-patchpack/source/.github/workflows/upload-cdn.yml

dependabot[bot] 49699333+dependabot[bot]@users.noreply.github.com
Upgrade: [CI] bump the actions group with 9 updates (#11881)

Bumps the actions group with 9 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `3` | `4` |
| [actions/cache](https://github.com/actions/cache) | `3` | `4` |
| [actions/github-script](https://github.com/actions/github-script) | `6` | `7` |
| [OpenTTD/actions](https://github.com/openttd/actions) | `2` | `5` |
| [github/codeql-action](https://github.com/github/codeql-action) | `2` | `3` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `3` | `4` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `3` | `4` |
| [tibdex/github-app-token](https://github.com/tibdex/github-app-token) | `1` | `2` |
| [peter-evans/repository-dispatch](https://github.com/peter-evans/repository-dispatch) | `2` | `3` |

Updates `actions/checkout` from 3 to 4
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

Updates `actions/cache` from 3 to 4
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

Updates `actions/github-script` from 6 to 7
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

Updates `OpenTTD/actions` from 2 to 5
- [Release notes](https://github.com/openttd/actions/releases)
- [Commits](https://github.com/openttd/actions/compare/v2...v5)

Updates `github/codeql-action` from 2 to 3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

Updates `actions/download-artifact` from 3 to 4
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

Updates `actions/upload-artifact` from 3 to 4
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

Updates `tibdex/github-app-token` from 1 to 2
- [Release notes](https://github.com/tibdex/github-app-token/releases)
- [Commits](https://github.com/tibdex/github-app-token/compare/v1...v2)

Updates `peter-evans/repository-dispatch` from 2 to 3
- [Release notes](https://github.com/peter-evans/repository-dispatch/releases)
- [Commits](https://github.com/peter-evans/repository-dispatch/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: actions
- dependency-name: actions/cache
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: actions
- dependency-name: actions/github-script
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: actions
- dependency-name: OpenTTD/actions
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: actions
- dependency-name: github/codeql-action
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: actions
- dependency-name: actions/download-artifact
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: actions
- dependency-name: actions/upload-artifact
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: actions
- dependency-name: tibdex/github-app-token
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: actions
- dependency-name: peter-evans/repository-dispatch
dependency-type: direct:production
update-type: version-update:semver-major
dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
name: Upload (CDN)

on:
  workflow_call:
    inputs:
      version:
        required: true
        type: string
      folder:
        required: true
        type: string
      trigger_type:
        required: true
        type: string

jobs:
  prepare:
    name: Prepare

    runs-on: ubuntu-latest

    steps:
    - name: Download all bundles
      uses: actions/download-artifact@v4

    - name: Calculate checksums
      run: |
        echo "::group::Move bundles to a single folder"
        mkdir bundles
        mv openttd-*/* bundles/
        echo "::endgroup::"

        cd bundles
        for i in $(ls openttd-*); do
          echo "::group::Calculating checksums for ${i}"
          openssl dgst -r -md5 -hex $i > $i.md5sum
          openssl dgst -r -sha1 -hex $i > $i.sha1sum
          openssl dgst -r -sha256 -hex $i > $i.sha256sum
          echo "::endgroup::"
        done

        # Some targets generate files that are meant for our-eyes-only.
        # They are stored in the "internal" folder, and contains bundles
        # for targets like Windows Store. No user has a benefit of knowing
        # they exist, hence: internal.
        if [ -e internal ]; then
          cd internal
          for i in $(ls openttd-*); do
            echo "::group::Calculating checksums for ${i}"
            openssl dgst -r -md5 -hex $i > $i.md5sum
            openssl dgst -r -sha1 -hex $i > $i.sha1sum
            openssl dgst -r -sha256 -hex $i > $i.sha256sum
            echo "::endgroup::"
          done
        fi

    - name: Merge symbols
      run: |
        mkdir symbols
        cp -R symbols-*/* symbols/

        # Compress all files as gzip, to reduce cost of storage on the CDN.
        for i in $(find symbols -mindepth 2 -type f); do
          gzip ${i}
        done

        # Leave a mark in each folder what version actually created the symbol file.
        for i in $(find symbols -mindepth 2 -type d); do
          touch ${i}/.${{ inputs.version }}.txt
        done

    - name: Store bundles
      uses: actions/upload-artifact@v4
      with:
        name: cdn-bundles
        path: bundles/*
        retention-days: 5

    - name: Store breakpad symbols
      uses: actions/upload-artifact@v4
      with:
        name: cdn-symbols
        path: symbols/*
        retention-days: 5

  publish-bundles:
    needs:
    - prepare

    name: Publish bundles
    uses: OpenTTD/actions/.github/workflows/rw-cdn-upload.yml@v5
    secrets:
      CDN_SIGNING_KEY: ${{ secrets.CDN_SIGNING_KEY }}
      DEPLOYMENT_APP_ID: ${{ secrets.DEPLOYMENT_APP_ID }}
      DEPLOYMENT_APP_PRIVATE_KEY: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }}
    with:
      artifact-name: cdn-bundles
      folder: ${{ inputs.folder }}
      version: ${{ inputs.version }}

  publish-symbols:
    needs:
    - prepare

    name: Publish symbols
    uses: OpenTTD/actions/.github/workflows/rw-symbols-upload.yml@v5
    secrets:
      SYMBOLS_SIGNING_KEY: ${{ secrets.SYMBOLS_SIGNING_KEY }}
    with:
      artifact-name: cdn-symbols
      repository: OpenTTD

  docs:
    if: ${{ inputs.trigger_type == 'new-master' }}
    needs:
    - publish-bundles

    name: Publish docs

    runs-on: ubuntu-latest

    steps:
    - name: Generate access token
      id: generate_token
      uses: tibdex/github-app-token@v2
      with:
        app_id: ${{ secrets.DEPLOYMENT_APP_ID }}
        private_key: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }}
        repositories: >-
          ["OpenTTD/workflows"]

    - name: Trigger 'Publish Docs'
      uses: peter-evans/repository-dispatch@v3
      with:
        token: ${{ steps.generate_token.outputs.token }}
        repository: OpenTTD/workflows
        event-type: publish-docs
        client-payload: '{"version": "${{ inputs.version }}", "folder": "${{ inputs.folder }}"}'