Files
pezkuwi-subxt/.github/workflows/release-02_create-draft.yml
T
dependabot[bot] f90837b000 Bump actions/download-artifact from 2 to 3 (#1273)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-20 14:52:54 +02:00

282 lines
10 KiB
YAML

name: Release - Create draft
on:
workflow_dispatch:
inputs:
ref1:
description: The 'from' tag to use for the diff
default: parachains-v9.0.0
required: true
ref2:
description: The 'to' tag to use for the diff
default: release-parachains-v10.0.0
required: true
release_type:
description: Pass "client" for client releases, leave empty otherwise
required: false
pre_release:
description: For pre-releases
default: "true"
required: true
notification:
description: Whether or not to notify over Matrix
default: "true"
required: true
jobs:
get-rust-versions:
runs-on: ubuntu-latest
container:
image: paritytech/ci-linux:production
outputs:
rustc-stable: ${{ steps.get-rust-versions.outputs.stable }}
rustc-nightly: ${{ steps.get-rust-versions.outputs.nightly }}
steps:
- id: get-rust-versions
run: |
echo "::set-output name=stable::$(rustc +stable --version)"
echo "::set-output name=nightly::$(rustc +nightly --version)"
# We do not skip the entire job for client builds (although we don't need it)
# because it is a dep of the next job. However we skip the time consuming steps.
build-runtimes:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- category: assets
runtime: statemine
- category: assets
runtime: statemint
- category: assets
runtime: westmint
- category: contracts
runtime: contracts-rococo
- category: starters
runtime: seedling
- category: starters
runtime: shell
- category: testing
runtime: rococo-parachain
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref2 }}
- name: Cache target dir
if: ${{ github.event.inputs.release_type != 'client' }}
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/runtime/${{ matrix.runtime }}/target"
key: srtool-target-${{ matrix.runtime }}-${{ github.sha }}
restore-keys: |
srtool-target-${{ matrix.runtime }}-
srtool-target-
- name: Build ${{ matrix.runtime }} runtime
if: ${{ github.event.inputs.release_type != 'client' }}
id: srtool_build
uses: chevdor/srtool-actions@v0.4.0
with:
image: paritytech/srtool
chain: ${{ matrix.runtime }}
runtime_dir: parachains/runtimes/${{ matrix.category }}/${{ matrix.runtime }}
- name: Store srtool digest to disk
if: ${{ github.event.inputs.release_type != 'client' }}
run: |
echo '${{ steps.srtool_build.outputs.json }}' | \
jq > ${{ matrix.runtime }}-srtool-digest.json
- name: Upload ${{ matrix.runtime }} srtool json
if: ${{ github.event.inputs.release_type != 'client' }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.runtime }}-srtool-json
path: ${{ matrix.runtime }}-srtool-digest.json
- name: Upload ${{ matrix.runtime }} runtime
if: ${{ github.event.inputs.release_type != 'client' }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.runtime }}-runtime
path: |
${{ steps.srtool_build.outputs.wasm_compressed }}
publish-draft-release:
runs-on: ubuntu-latest
needs: ["get-rust-versions", "build-runtimes"]
outputs:
release_url: ${{ steps.create-release.outputs.html_url }}
asset_upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
fetch-depth: 0
path: cumulus
ref: ${{ github.event.inputs.ref2 }}
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.0
- name: Download srtool json output
uses: actions/download-artifact@v3
- name: Prepare tooling
run: |
cd cumulus/scripts/ci/changelog
gem install bundler changelogerator:0.9.1
bundle install
changelogerator --help
URL=https://github.com/chevdor/tera-cli/releases/download/v0.2.1/tera-cli_linux_amd64.deb
wget $URL -O tera.deb
sudo dpkg -i tera.deb
tera --version
- name: Generate release notes
env:
RUSTC_STABLE: ${{ needs.get-rust-versions.outputs.rustc-stable }}
RUSTC_NIGHTLY: ${{ needs.get-rust-versions.outputs.rustc-nightly }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NO_CACHE: 1
DEBUG: 1
SHELL_DIGEST: ${{ github.workspace}}/shell-srtool-json/shell-srtool-digest.json
WESTMINT_DIGEST: ${{ github.workspace}}/westmint-srtool-json/westmint-srtool-digest.json
STATEMINE_DIGEST: ${{ github.workspace}}/statemine-srtool-json/statemine-srtool-digest.json
STATEMINT_DIGEST: ${{ github.workspace}}/statemint-srtool-json/statemint-srtool-digest.json
ROCOCO_PARA_DIGEST: ${{ github.workspace}}/rococo-parachain-srtool-json/rococo-parachain-srtool-digest.json
CANVAS_KUSAMA_DIGEST: ${{ github.workspace}}/contracts-rococo-srtool-json/contracts-rococo-srtool-digest.json
REF1: ${{ github.event.inputs.ref1 }}
REF2: ${{ github.event.inputs.ref2 }}
PRE_RELEASE: ${{ github.event.inputs.pre_release }}
RELEASE_TYPE: ${{ github.event.inputs.release_type }}
run: |
find ${{env.GITHUB_WORKSPACE}} -type f -name "*-srtool-digest.json"
if [ "$RELEASE_TYPE" == "client" ]; then
ls -al $SHELL_DIGEST || true
ls -al $WESTMINT_DIGEST || true
ls -al $STATEMINE_DIGEST || true
ls -al $STATEMINT_DIGEST || true
ls -al $ROCOCO_PARA_DIGEST || true
ls -al $CANVAS_KUSAMA_DIGEST || true
fi
echo "The diff will be computed from $REF1 to $REF2"
cd cumulus/scripts/ci/changelog
./bin/changelog $REF1 $REF2 release-notes.md
ls -al {release-notes.md,context.json} || true
- name: Archive srtool json
if: ${{ github.event.inputs.release_type != 'client' }}
uses: actions/upload-artifact@v3
with:
name: srtool-json
path: |
**/*-srtool-digest.json
- name: Archive context artifact
uses: actions/upload-artifact@v3
with:
name: release-notes-context
path: |
context.json
- name: Create draft release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
body_path: ./cumulus/scripts/ci/changelog/release-notes.md
tag_name: ${{ github.event.inputs.ref2 }}
release_name: ${{ github.event.inputs.ref2 }}
draft: true
publish-runtimes:
if: ${{ github.event.inputs.release_type != 'client' }}
runs-on: ubuntu-latest
needs: ["publish-draft-release"]
env:
RUNTIME_DIR: parachains/runtimes
strategy:
matrix:
include:
- category: assets
runtime: statemine
- category: assets
runtime: statemint
- category: assets
runtime: westmint
- category: contracts
runtime: contracts-rococo
- category: starters
runtime: seedling
- category: starters
runtime: shell
- category: testing
runtime: rococo-parachain
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref2 }}
- name: Download artifacts
uses: actions/download-artifact@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.0
- name: Get runtime version for ${{ matrix.runtime }}
id: get-runtime-ver
run: |
echo "require './scripts/ci/github/runtime-version.rb'" > script.rb
echo "puts get_runtime(runtime: \"${{ matrix.runtime }}\", runtime_dir: \"$RUNTIME_DIR/${{ matrix.category }}\")" >> script.rb
echo "Current folder: $PWD"
ls "$RUNTIME_DIR/${{ matrix.category }}/${{ matrix.runtime }}"
runtime_ver=$(ruby script.rb)
echo "Found version: >$runtime_ver<"
echo "::set-output name=runtime_ver::$runtime_ver"
- name: Fix runtime name
id: fix-runtime-path
run: |
cd "${{ matrix.runtime }}-runtime/"
mv "$(sed -E 's/-(.*)/_\1/' <<< ${{ matrix.runtime }})_runtime.compact.compressed.wasm" "${{ matrix.runtime }}_runtime.compact.compressed.wasm" || true
- name: Upload compressed ${{ 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.compressed.wasm"
asset_name: ${{ matrix.runtime }}_runtime-v${{ steps.get-runtime-ver.outputs.runtime_ver }}.compact.compressed.wasm
asset_content_type: application/wasm
post_to_matrix:
if: ${{ github.event.inputs.notification == 'true' }}
runs-on: ubuntu-latest
needs: publish-draft-release
steps:
- name: Internal polkadot channel
uses: s3krit/matrix-message-action@v0.0.3
with:
room_id: ${{ secrets.INTERNAL_CUMULUS_MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: |
**New draft for ${{ github.repository }}**: ${{ github.event.inputs.ref2 }}<br/>
Draft release created: [draft](${{ needs.publish-draft-release.outputs.release_url }})
NOTE: The link above will no longer be valid if the draft is edited. You can then use the following link:
[${{ github.server_url }}/${{ github.repository }}/releases](${{ github.server_url }}/${{ github.repository }}/releases)
server: "matrix.parity.io"