Skip to content

Commit

Permalink
Merge pull request #12 from ElrondNetwork/github-actions
Browse files Browse the repository at this point in the history
Define release workflow.
  • Loading branch information
andreibancioiu authored Mar 23, 2022
2 parents 2361ab0 + ea29ac9 commit 32755cc
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Create release

on:
workflow_dispatch:
inputs:
tag:
required: true
description: Release tag
title:
required: true
description: Release title

env:
# https://github.com/actions/runner/issues/863 ($HOME is overridden for containers)
ELROND_HOME: /home/elrond
REPO_PATH: /home/elrond/sc-metabonding-rs
REPO_URL: https://github.com/ElrondNetwork/sc-metabonding-rs.git

jobs:
build:
runs-on: ubuntu-latest
# See: https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container
container:
image: elrondnetwork/elrond-sdk-erdpy-rust:frozen-003
steps:
# We don't use actions/checkout, since we want to control the location of the repository,
# in order to achieve deterministic builds.
- name: Check out code
run: |
echo "Cloning ref: $GITHUB_REF_NAME"
cd $ELROND_HOME && git clone $REPO_URL --branch=$GITHUB_REF_NAME --depth=1
- name: Build WASM files
run: |
# Setting $HOME is required by erdpy.
export HOME=$ELROND_HOME
cd $REPO_PATH
erdpy --verbose contract build
- name: Save artifacts
uses: actions/upload-artifact@v2
with:
name: built-contracts
path: |
${{ env.REPO_PATH }}/**/output/*.wasm
${{ env.REPO_PATH }}/**/output/*.abi.json
if-no-files-found: error

release:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: "0"

- name: Download all workflow artifacts
uses: actions/download-artifact@v2
with:
path: assets

- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "## Checksums (SHA 256):" >> notes.txt
echo "" >> notes.txt
for i in $(find ./assets -type f); do
filename=$(basename ${i})
checksum=($(sha256sum ${i}))
echo " - **${filename}**: \`${checksum}\`" >> notes.txt
done
gh release create --prerelease ${{ github.event.inputs.tag }} --prerelease --title="${{ github.event.inputs.title }}" --generate-notes --notes-file=notes.txt
sleep 10
gh release upload ${{ github.event.inputs.tag }} $(find ./assets -type f)

0 comments on commit 32755cc

Please sign in to comment.