Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add loggin for local testing
  • Loading branch information
chevdor committed Oct 13, 2021
commit 9899f2d83926dcc572831fba44b0202f6d0b3e31
2 changes: 1 addition & 1 deletion .github/workflows/publish-draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
RUSTC_NIGHTLY: ${{ needs.get-rust-versions.outputs.rustc-nightly }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gem install changelogerator git toml
gem install changelogerator git toml logger
ruby $GITHUB_WORKSPACE/polkadot/scripts/github/generate_release_text.rb | tee release_text.md
- name: Create draft release
id: create-release
Expand Down
30 changes: 29 additions & 1 deletion scripts/github/generate_release_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,36 @@
require 'json'
require 'octokit'
require 'toml'
require 'logger'
require_relative './lib.rb'

$logger = Logger.new(STDOUT)
$logger.level = Logger::DEBUG
$logger.debug("Start")

# Check if all the required ENV are set
# This is especially convenient when testing locally
def check_env()
if ENV['CI'] != 'true' then
$logger.info("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.info("- %s:\tset: %s, len: %d" % [x, env.length > 0 || false, env.length])
else
$logger.error("- %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.info("Connecting to Github")
github_client = Octokit::Client.new(
access_token: token
)
Expand All @@ -19,13 +45,14 @@

# 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.info("Generate changelog for Polkadot")
polkadot_cl = Changelog.new(
'paritytech/polkadot', last_ref, current_ref, token: token
)
Expand All @@ -47,6 +74,7 @@ def get_substrate_commit(client, ref)
substrate_prev_sha = get_substrate_commit(github_client, last_ref)
substrate_cur_sha = get_substrate_commit(github_client, current_ref)

$logger.info("Generate changelog for Substrate")
substrate_cl = Changelog.new(
'paritytech/substrate', substrate_prev_sha, substrate_cur_sha,
token: token,
Expand Down
4 changes: 2 additions & 2 deletions scripts/github/polkadot_release.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ This release was tested against the following versions of `rustc`. Other version
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.compressed.wasm - <%= polkadot_json['runtimes']['compressed']['prop'] %>`
* `kusama_runtime-v<%= kusama_runtime %>.compact.compressed.wasm - <%= kusama_json['runtimes']['compressed']['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
Expand Down