# HG changeset patch # User Patric Stout # Date 2023-07-01 12:30:57 # Node ID 9107d9c1e34e7851f15cb93ab91148d2586fb5fd # Parent 9dcc60376c98fda2081f89035fbddd31114f63fd Change: [CI] upload releases to new CDN (#11093) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -76,8 +76,8 @@ jobs: with: version: ${{ needs.source.outputs.version }} - upload-aws: - name: Upload (AWS) + upload-cdn: + name: Upload (CDN) needs: - source - docs @@ -90,7 +90,7 @@ jobs: # The always() makes sure the rest is always evaluated. if: always() && needs.source.result == 'success' && needs.docs.result == 'success' && needs.linux.result == 'success' && needs.macos.result == 'success' && needs.windows.result == 'success' && (needs.windows-store.result == 'success' || needs.windows-store.result == 'skipped') - uses: ./.github/workflows/upload-aws.yml + uses: ./.github/workflows/upload-cdn.yml secrets: inherit with: diff --git a/.github/workflows/upload-aws.yml b/.github/workflows/upload-aws.yml deleted file mode 100644 --- a/.github/workflows/upload-aws.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Upload (AWS) - -on: - workflow_call: - inputs: - version: - required: true - type: string - folder: - required: true - type: string - trigger_type: - required: true - type: string - -jobs: - upload: - name: Upload (AWS) - - runs-on: ubuntu-20.04 - - steps: - - name: Download all bundles - uses: actions/download-artifact@v3 - - - 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: Upload bundles to AWS - run: | - aws s3 cp --recursive --only-show-errors bundles/ s3://${{ secrets.CDN_S3_BUCKET }}/${{ inputs.folder }}/${{ inputs.version }}/ - - # We do not invalidate the CloudFront distribution here. The trigger - # for "New OpenTTD release" first updated the manifest files and - # creates an index.html. We invalidate after that, so everything - # becomes visible at once. - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }} - - - name: Trigger 'New OpenTTD release' - uses: peter-evans/repository-dispatch@v2 - with: - token: ${{ secrets.DEPLOYMENT_TOKEN }} - repository: OpenTTD/workflows - event-type: ${{ inputs.trigger_type }} - client-payload: '{"version": "${{ inputs.version }}", "folder": "${{ inputs.folder }}"}' diff --git a/.github/workflows/upload-cdn.yml b/.github/workflows/upload-cdn.yml new file mode 100644 --- /dev/null +++ b/.github/workflows/upload-cdn.yml @@ -0,0 +1,103 @@ +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@v3 + + - 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: Store bundles + uses: actions/upload-artifact@v3 + with: + name: cdn-bundles + path: bundles/* + retention-days: 5 + + publish: + needs: + - prepare + + name: Publish + uses: OpenTTD/actions/.github/workflows/rw-cdn-upload.yml@v4 + 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 }} + + docs: + if: ${{ inputs.trigger_type == 'new-master' }} + needs: + - publish + + name: Publish docs + + runs-on: ubuntu-latest + + steps: + - name: Generate access token + id: generate_token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.DEPLOYMENT_APP_ID }} + private_key: ${{ secrets.DEPLOYMENT_APP_PRIVATE_KEY }} + repository: OpenTTD/workflows + + - name: Trigger 'Publish Docs' + uses: peter-evans/repository-dispatch@v2 + with: + token: ${{ secrets.DEPLOYMENT_TOKEN }} + repository: OpenTTD/workflows + event-type: publish-docs + client-payload: '{"version": "${{ inputs.version }}", "folder": "${{ inputs.folder }}"}' diff --git a/.github/workflows/upload-gog.yml b/.github/workflows/upload-gog.yml --- a/.github/workflows/upload-gog.yml +++ b/.github/workflows/upload-gog.yml @@ -14,8 +14,25 @@ jobs: runs-on: ubuntu-20.04 steps: - - name: Download all bundles + - name: Download bundle (Windows x86) + uses: actions/download-artifact@v3 + with: + name: openttd-windows-x86 + + - name: Download bundle (Windows x64) uses: actions/download-artifact@v3 + with: + name: openttd-windows-x64 + + - name: Download bundle (MacOS) + uses: actions/download-artifact@v3 + with: + name: openttd-macos-universal + + - name: Download bundle (Linux) + uses: actions/download-artifact@v3 + with: + name: openttd-linux-generic - name: Install GOG Galaxy Build Creator run: | diff --git a/.github/workflows/upload-steam.yml b/.github/workflows/upload-steam.yml --- a/.github/workflows/upload-steam.yml +++ b/.github/workflows/upload-steam.yml @@ -17,8 +17,25 @@ jobs: runs-on: ubuntu-20.04 steps: - - name: Download all bundles + - name: Download bundle (Windows x86) + uses: actions/download-artifact@v3 + with: + name: openttd-windows-x86 + + - name: Download bundle (Windows x64) uses: actions/download-artifact@v3 + with: + name: openttd-windows-x64 + + - name: Download bundle (MacOS) + uses: actions/download-artifact@v3 + with: + name: openttd-macos-universal + + - name: Download bundle (Linux) + uses: actions/download-artifact@v3 + with: + name: openttd-linux-generic - name: Setup steamcmd uses: CyberAndrii/setup-steamcmd@v1