-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from ElrondNetwork/github-actions
Define release workflow.
- Loading branch information
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |