Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: uploading of GRFcodec releases #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,31 @@ jobs:
run: |
cd build
gh release upload ${{ github.event.release.tag_name }} bundles/*

upload:
name: Upload
needs:
- source
- windows

runs-on: ubuntu-latest

# This job is empty, but ensures no upload job starts before all targets finished and are successful.
steps:
- name: Build completed
run: |
true

upload-cdn:
name: Upload (CDN)
needs:
- source
- upload

uses: ./.github/workflows/upload-cdn.yml
secrets: inherit

with:
version: ${{ needs.source.outputs.version }}
folder: ${{ needs.source.outputs.folder }}
trigger_type: ${{ needs.source.outputs.trigger_type }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, the source job in this workflow doesn't define either of those three. For reference:

https://github.com/OpenTTD/OpenTTD/blob/master/.github/workflows/release-source.yml#L145

It isn't completely trivial to create the right variables, as it needs to detect whether it is a nightly or release.

62 changes: 62 additions & 0 deletions .github/workflows/upload-cdn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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
Copy link
Contributor

@glx22 glx22 Sep 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have any artifacts as gh is used to directly upload bundles in the release assets.


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

cd bundles
for i in $(ls grfcodec-*); 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

- name: Store bundles
uses: actions/upload-artifact@v4
with:
name: cdn-bundles
path: bundles/*
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 }}