Files
pezkuwi-subxt/polkadot/.github/workflows/publish-draft-release.yml
T
Martin Pugh 25cd67436c Bump version to v0.9.1 and spec_version to v9010 (#3001)
* bump version and spec_version

* fix generate_release_text.rb

* Revert "fix generate_release_text.rb"

This reverts commit 9e01e0ae4f6db2155d123f69063db7d7564588e0.

* fix publish_draft_release

* fix publish_draft_release

* update target cache
2021-05-11 15:27:52 +02:00

146 lines
5.1 KiB
YAML

name: Publish draft release
on:
push:
tags:
# Catches v1.2.3 and v1.2.3-rc1
- v[0-9]+.[0-9]+.[0-9]+*
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)"
build-runtimes:
runs-on: ubuntu-latest
strategy:
matrix:
runtime: ['polkadot', 'kusama']
container:
image: paritytech/srtool:nightly-2021-03-15
volumes:
- ${{ github.workspace }}:/build
env:
PACKAGE: ${{ matrix.runtime }}-runtime
RUSTC_VERSION: nightly-2020-10-27
steps:
- uses: actions/checkout@v2
- name: Cache target dir
uses: actions/cache@v2
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
id: build-runtime
shell: bash
env:
srtool_output_filename: ${{ matrix.runtime }}_srtool_output.json
run: |
cd /build
pwd
ls -la
build --json | tee $srtool_output_filename
cat $srtool_output_filename
while IFS= read -r line; do
echo "::set-output name=$line::$(jq -r ".$line" < $srtool_output_filename)"
done <<< "$(jq -r 'keys[]' < $srtool_output_filename)"
- name: Upload ${{ matrix.runtime }} srtool json
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.runtime }}-srtool-json
path: ${{ matrix.runtime }}_srtool_output.json
- name: Upload ${{ matrix.runtime }} runtime
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.runtime }}-runtime
path: "${{ steps.build-runtime.outputs.wasm }}"
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:
- uses: actions/checkout@v2
with:
fetch-depth: 0
path: polkadot
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- name: Download srtool json output
uses: actions/download-artifact@v2
- name: Generate release text
env:
RUSTC_STABLE: ${{ needs.get-rust-versions.outputs.rustc-stable }}
RUSTC_NIGHTLY: ${{ needs.get-rust-versions.outputs.rustc-nightly }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gem install changelogerator git toml
ruby $GITHUB_WORKSPACE/polkadot/scripts/github/generate_release_text.rb | tee release_text.md
- name: Create draft release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Polkadot ${{ github.ref }}
body_path: ./release_text.md
draft: true
publish-runtimes:
runs-on: ubuntu-latest
needs: ['publish-draft-release']
strategy:
matrix:
runtime: ['polkadot', 'kusama']
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- name: Set up Ruby 2.7
uses: actions/setup-ruby@v1
with:
ruby-version: 2.7
- name: Get runtime version
id: get-runtime-ver
run: |
ls
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 ${{ 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
post_to_matrix:
runs-on: ubuntu-latest
needs: publish-draft-release
steps:
- name: Internal polkadot channel
uses: s3krit/matrix-message-action@v0.0.2
with:
room_id: ${{ secrets.INTERNAL_POLKADOT_MATRIX_ROOM_ID }}
access_token: ${{ secrets.MATRIX_ACCESS_TOKEN }}
message: "**New version of polkadot tagged**: ${{ github.ref }}<br/>Draft release created: ${{ needs.publish-draft-release.outputs.release_url }}"
server: "matrix.parity.io"