diff --git a/polkadot/.github/workflows/publish-draft-release.yml b/polkadot/.github/workflows/publish-draft-release.yml index 5b1855c32cc3883bcfa48ca818c601658331772b..e3c995e9bce1897c4cbdb3ebc7ccd9591784f026 100644 --- a/polkadot/.github/workflows/publish-draft-release.yml +++ b/polkadot/.github/workflows/publish-draft-release.yml @@ -55,7 +55,6 @@ jobs: with: name: ${{ matrix.runtime }}-runtime path: | - ${{ steps.srtool_build.outputs.wasm }} ${{ steps.srtool_build.outputs.wasm_compressed }} publish-draft-release: @@ -114,15 +113,6 @@ jobs: ls "${{ matrix.runtime }}-runtime" runtime_ver="$(ruby -e 'require "./scripts/github/lib.rb"; puts get_runtime("${{ matrix.runtime }}")')" echo "::set-output name=runtime_ver::$runtime_ver" - - name: Upload compact ${{ matrix.runtime }} wasm - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.publish-draft-release.outputs.asset_upload_url }} - asset_path: "${{ matrix.runtime }}-runtime/${{ matrix.runtime }}_runtime.compact.wasm" - asset_name: ${{ matrix.runtime }}_runtime-v${{ steps.get-runtime-ver.outputs.runtime_ver }}.compact.wasm - asset_content_type: application/wasm - name: Upload compressed ${{ matrix.runtime }} wasm uses: actions/upload-release-asset@v1 env: diff --git a/polkadot/scripts/github/generate_release_text.rb b/polkadot/scripts/github/generate_release_text.rb index a35154bd1a6640d839f26c133bd30e16ab6a1650..c1fe06f45ebde303b81cb3bdb2c37c99b5fdea53 100644 --- a/polkadot/scripts/github/generate_release_text.rb +++ b/polkadot/scripts/github/generate_release_text.rb @@ -9,8 +9,34 @@ require 'octokit' require 'toml' require_relative './lib.rb' +# A logger only active when NOT running in CI +def logger(s) + puts "â–¶ DEBUG: %s" % [s] if ENV['CI'] != 'true' +end + +# Check if all the required ENV are set +# This is especially convenient when testing locally +def check_env() + if ENV['CI'] != 'true' then + logger("Running locally") + vars = ['GITHUB_REF', 'GITHUB_TOKEN', 'GITHUB_WORKSPACE', 'GITHUB_REPOSITORY', 'RUSTC_STABLE', 'RUSTC_NIGHTLY'] + vars.each { |x| + env = (ENV[x] || "") + if env.length > 0 then + logger("- %s:\tset: %s, len: %d" % [x, env.length > 0 || false, env.length]) + else + logger("- %s:\tset: %s, len: %d" % [x, env.length > 0 || false, env.length]) + end + } + end +end + +check_env() + current_ref = ENV['GITHUB_REF'] token = ENV['GITHUB_TOKEN'] + +logger("Connecting to Github") github_client = Octokit::Client.new( access_token: token ) @@ -19,13 +45,15 @@ polkadot_path = ENV['GITHUB_WORKSPACE'] + '/polkadot/' # Generate an ERB renderer based on the template .erb file renderer = ERB.new( - File.read(ENV['GITHUB_WORKSPACE'] + '/polkadot/scripts/github/polkadot_release.erb'), + File.read(File.join(polkadot_path, 'scripts/github/polkadot_release.erb')), trim_mode: '<>' ) # get ref of last polkadot release last_ref = 'refs/tags/' + github_client.latest_release(ENV['GITHUB_REPOSITORY']).tag_name +logger("Last ref: " + last_ref) +logger("Generate changelog for Polkadot") polkadot_cl = Changelog.new( 'paritytech/polkadot', last_ref, current_ref, token: token ) @@ -47,6 +75,7 @@ end substrate_prev_sha = get_substrate_commit(github_client, last_ref) substrate_cur_sha = get_substrate_commit(github_client, current_ref) +logger("Generate changelog for Substrate") substrate_cl = Changelog.new( 'paritytech/substrate', substrate_prev_sha, substrate_cur_sha, token: token, diff --git a/polkadot/scripts/github/polkadot_release.erb b/polkadot/scripts/github/polkadot_release.erb index 2078fa3bb96f3e464980bee4b550a831f8df160f..3fcf07dddc5c61dccf22eab54ba4efe9246a4cae 100644 --- a/polkadot/scripts/github/polkadot_release.erb +++ b/polkadot/scripts/github/polkadot_release.erb @@ -11,11 +11,11 @@ This release was tested against the following versions of `rustc`. Other version - <%= rustc_stable %> - <%= rustc_nightly %> -WASM runtimes built with [srtool](https://github.com/paritytech/srtool) using `<%= polkadot_json['rustc'] %>`. +WASM runtimes built with [<%= polkadot_json['info']['generator']['name'] %> v<%= polkadot_json['info']['generator']['version'] %>](https://github.com/paritytech/srtool) using `<%= polkadot_json['rustc'] %>`. Proposal hashes: -* `polkadot_runtime-v<%= polkadot_runtime %>.compact.wasm - <%= polkadot_json['prop'] %>` -* `kusama_runtime-v<%= kusama_runtime %>.compact.wasm - <%= kusama_json['prop'] %>` +* `polkadot_runtime-v<%= polkadot_runtime %>.compact.compressed.wasm`: `<%= polkadot_json['runtimes']['compressed']['prop'] %>` +* `kusama_runtime-v<%= kusama_runtime %>.compact.compressed.wasm`: `<%= kusama_json['runtimes']['compressed']['prop'] %>` <% unless misc_changes.empty? %> ## Changes