Skip to content

Bump download-artifact #1543

Bump download-artifact

Bump download-artifact #1543

name: publish draft releases
on:
push:
branches: [manta, release-**]
tags:
- 'v[0-9]+\.[0-9]+\.[0-9]+*'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
jobs:
get-rust-versions:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-20.04
container:
image: paritytech/ci-linux:production
outputs:
rustc-stable: ${{ steps.get-rust-versions.outputs.stable }}
rustc-nightly: ${{ steps.get-rust-versions.outputs.nightly }}
env:
CARGO_TERM_COLOR: always
steps:
- id: get-rust-versions
run: |
echo "::set-output name=stable::$(rustc +stable --version)"
echo "::set-output name=nightly::$(rustc +nightly --version)"
build-runtimes:
timeout-minutes: 180
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-20.04
env:
CARGO_TERM_COLOR: always
strategy:
matrix:
runtime:
- name: calamari
- name: manta
steps:
- uses: actions/checkout@v2
- name: cache target dir
uses: actions/cache@v2
with:
path: "$GITHUB_WORKSPACE/runtime/${{ matrix.runtime.name }}/target"
key: srtool-target-${{ matrix.runtime.name }}-${{ github.sha }}
restore-keys: |
srtool-target-${{ matrix.runtime.name }}
- name: build runtime
id: srtool-build
uses: chevdor/[email protected]
env:
BUILD_OPTS: "--features on-chain-release-build"
with:
image: paritytech/srtool
tag: 1.74.0
chain: ${{ matrix.runtime.name }}
profile: "production"
- name: persist srtool digest
run: >
echo '${{ steps.srtool-build.outputs.json }}' |
jq > ${{ matrix.runtime.name }}-srtool-output.json
- if: always()
name: upload srtool json
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.runtime.name }}-srtool-json
path: ${{ matrix.runtime.name }}-srtool-output.json
- if: always()
name: upload runtime
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.runtime.name }}-runtime
path: |
${{ steps.srtool-build.outputs.wasm }}
${{ steps.srtool-build.outputs.wasm_compressed }}
build-node-current:
timeout-minutes: 180
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-20.04
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v2
- name: install sccache
env:
SCCACHE_RELEASE_URL: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.5.3
run: |
sudo apt update
sudo apt install -y curl
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$SCCACHE_RELEASE_URL/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
- name: cache sccache
uses: actions/cache@v2
continue-on-error: false
with:
path: ~/.cache/sccache
key: sccache-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
sccache-
- name: start sccache server
run: sccache --start-server
- name: init
shell: bash
run: |
sudo apt update
sudo apt install -y pkg-config libssl-dev protobuf-compiler curl build-essential clang git
protoc --version
curl -s https://sh.rustup.rs -sSf | sh -s -- -y
source ${HOME}/.cargo/env
rustup toolchain install stable
rustup default stable
rustup update
rustup target add wasm32-unknown-unknown
rustup install 1.74.0
rustup target add wasm32-unknown-unknown --toolchain 1.74.0
- name: cache cargo
uses: Swatinem/rust-cache@v2
- name: build
shell: bash
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: ~/.cache/sccache
run: |
source ${HOME}/.cargo/env
RUSTC_BOOTSTRAP=1 cargo +1.74.0 build --profile production --verbose
- name: stop sccache server
run: sccache --stop-server || true
- if: always()
name: upload
uses: actions/upload-artifact@v4
with:
name: manta
path: target/production/manta
- if: always()
name: upload
uses: actions/upload-artifact@v4
with:
name: config-for-integration-test
path: .github/resources/config-for-integration-test.json
- if: always()
name: upload
uses: actions/upload-artifact@v4
with:
name: config-for-runtime-upgrade-test
path: .github/resources/config-for-runtime-upgrade-test.json
# THE FOLLOWING HAPPENS ONLY WHEN TAGGED WITH A vX.Y.Z TAG
create-draft-release:
runs-on: ubuntu-20.04
needs: [build-runtimes]
outputs:
release_url: ${{ steps.create-release.outputs.html_url }}
asset_upload_url: ${{ steps.create-release.outputs.upload_url }}
if: startsWith(github.ref, 'refs/tags')
steps:
- 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: ${{ github.ref }}
draft: true
publish-runtimes:
runs-on: ubuntu-20.04
needs: create-draft-release
strategy:
matrix:
runtime:
- name: calamari
- name: manta
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.runtime.name }}-runtime
- uses: actions/download-artifact@v4
with:
name: ${{ matrix.runtime.name }}-srtool-json
- name: ruby setup
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: get runtime version
id: get-runtime-version
run: |
runtime_ver="$(ruby -e '
require "./scripts/github/lib.rb";
puts get_runtime("calamari")
')"
echo "::set-output name=runtime_ver::$runtime_ver"
- name: upload compact wasm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.asset_upload_url }}
asset_path: ${{ matrix.runtime.name }}_runtime.compact.wasm
asset_name: ${{ matrix.runtime.name }}-runtime-v${{ steps.get-runtime-version.outputs.runtime_ver }}.compact.wasm
asset_content_type: application/wasm
- name: upload compressed wasm
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.asset_upload_url }}
asset_path: ${{ matrix.runtime.name }}_runtime.compact.compressed.wasm
asset_name: ${{ matrix.runtime.name }}-runtime-v${{ steps.get-runtime-version.outputs.runtime_ver }}.compact.compressed.wasm
asset_content_type: application/wasm
- name: upload types json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.asset_upload_url }}
asset_path: types.json
asset_name: ${{ matrix.runtime.name }}-types-v${{ steps.get-runtime-version.outputs.runtime_ver }}.json
asset_content_type: application/json
- name: upload srtool output json
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.asset_upload_url }}
asset_path: ${{ matrix.runtime.name }}-srtool-output.json
asset_name: ${{ matrix.runtime.name }}-srtool-output-v${{ steps.get-runtime-version.outputs.runtime_ver }}.json
asset_content_type: application/json
publish-node:
runs-on: ubuntu-20.04
needs: [build-node-current, create-draft-release]
outputs:
download_url: ${{ steps.upload-manta.outputs.browser_download_url }}
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v4
with:
name: manta
- id: upload-manta
name: upload manta
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-draft-release.outputs.asset_upload_url }}
asset_path: manta
asset_name: manta
asset_content_type: application/octet-stream
brag:
runs-on: ubuntu-20.04
needs: [publish-runtimes, publish-node]
if: startsWith(github.ref, 'refs/tags')
steps:
- env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: raybot
DISCORD_AVATAR: https://gist.githubusercontent.com/grenade/66a46007b37778d81ee064394263b16c/raw/raybot.png
uses: Ilshidur/[email protected]
with:
args: 'draft runtime release ${{ github.ref }} created at ${{ needs.create-draft-release.outputs.release_url }}'