-
Notifications
You must be signed in to change notification settings - Fork 4
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 #55 from multiversx/create-release-workflow
Create release workflow
- Loading branch information
Showing
24 changed files
with
116 additions
and
12,213 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,71 @@ | ||
name: Create release | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: "0" | ||
|
||
- name: Create artifacts files | ||
run: | | ||
docker compose -f docker-compose.yml build | ||
docker compose -f docker-compose.yml up | ||
docker compose -f docker-compose.yml down -v | ||
- name: Package build output | ||
run: | | ||
BUILD_DIR=${GITHUB_WORKSPACE}/artifacts/contracts | ||
APP_VER_SHORT=$(git describe --tags) | ||
ARCHIVE="artifacts_""$APP_VER_SHORT"".zip" | ||
echo "ARCHIVE=${ARCHIVE}" >> $GITHUB_ENV | ||
sudo chown -R $USER: ${BUILD_DIR} | ||
chmod -R 755 ${BUILD_DIR} | ||
ls -al ${BUILD_DIR} | ||
zip -r -j ${ARCHIVE} ${BUILD_DIR} | ||
- name: Save artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.ARCHIVE }} | ||
path: ${{ env.ARCHIVE }} | ||
if-no-files-found: error | ||
release: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
# https://docs.github.com/en/free-pro-team@latest/actions/guides/storing-workflow-data-as-artifacts#downloading-or-deleting-artifacts | ||
# A directory for each artifact is created using its name | ||
- name: Download all workflow run artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: ${GITHUB_WORKSPACE} | ||
|
||
- name: Display structure of downloaded files | ||
run: ls -R | ||
working-directory: ${GITHUB_WORKSPACE} | ||
|
||
- name: Create release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh release create --draft --notes="Release draft from Github Actions" vNext | ||
sleep 10 | ||
for i in $(find ${GITHUB_WORKSPACE} -name '*.zip' -type f); do | ||
gh release upload vNext ${i} | ||
done |
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,39 @@ | ||
FROM node:22-alpine AS sol-compiler | ||
LABEL description="This Docker image compiles the Solidity contracts and prepares the .json and .hex files." | ||
|
||
WORKDIR /multiversx | ||
COPY . . | ||
|
||
RUN apk update && apk add jq | ||
|
||
RUN cp -u .env.example .env | ||
|
||
RUN yarn install | ||
RUN yarn compile | ||
|
||
RUN jq -r '.abi' artifacts/contracts/Bridge.sol/Bridge.json > artifacts/contracts/Bridge.sol/Bridge.abi.json | ||
RUN jq -r '.abi' artifacts/contracts/Proxy.sol/Proxy.json > artifacts/contracts/Proxy.sol/Proxy.abi.json | ||
RUN jq -r '.abi' artifacts/contracts/ERC20Safe.sol/ERC20Safe.json > artifacts/contracts/ERC20Safe.sol/ERC20Safe.abi.json | ||
RUN jq -r '.abi' artifacts/contracts/GenericERC20.sol/GenericERC20.json > artifacts/contracts/GenericERC20.sol/GenericERC20.abi.json | ||
RUN jq -r '.abi' artifacts/contracts/MintBurnERC20.sol/MintBurnERC20.json > artifacts/contracts/MintBurnERC20.sol/MintBurnERC20.abi.json | ||
|
||
RUN jq -r '.bytecode' artifacts/contracts/Bridge.sol/Bridge.json > artifacts/contracts/Bridge.sol/Bridge.hex | ||
RUN jq -r '.bytecode' artifacts/contracts/Proxy.sol/Proxy.json > artifacts/contracts/Proxy.sol/Proxy.hex | ||
RUN jq -r '.bytecode' artifacts/contracts/ERC20Safe.sol/ERC20Safe.json > artifacts/contracts/ERC20Safe.sol/ERC20Safe.hex | ||
RUN jq -r '.bytecode' artifacts/contracts/GenericERC20.sol/GenericERC20.json > artifacts/contracts/GenericERC20.sol/GenericERC20.hex | ||
RUN jq -r '.bytecode' artifacts/contracts/MintBurnERC20.sol/MintBurnERC20.json > artifacts/contracts/MintBurnERC20.sol/MintBurnERC20.hex | ||
|
||
FROM golang:1.20.7-bookworm AS go-builder | ||
LABEL description="This Docker image creates the go-wrappers for the Solidity contracts" | ||
|
||
RUN apt update && apt install -y zip unzip | ||
RUN go install github.com/ethereum/go-ethereum/cmd/[email protected] | ||
|
||
COPY --from=sol-compiler /multiversx /multiversx | ||
WORKDIR /multiversx | ||
|
||
RUN abigen --abi=artifacts/contracts/Bridge.sol/Bridge.abi.json --pkg=contract --out=artifacts/contracts/Bridge.sol/Bridge.go --type=Bridge | ||
RUN abigen --abi=artifacts/contracts/Proxy.sol/Proxy.abi.json --pkg=contract --out=artifacts/contracts/Proxy.sol/Proxy.go --type=Proxy | ||
RUN abigen --abi=artifacts/contracts/ERC20Safe.sol/ERC20Safe.abi.json --pkg=contract --out=artifacts/contracts/ERC20Safe.sol/ERC20Safe.go --type=ERC20Safe | ||
RUN abigen --abi=artifacts/contracts/GenericERC20.sol/GenericERC20.abi.json --pkg=contract --out=artifacts/contracts/GenericERC20.sol/GenericERC20.go --type=GenericERC20 | ||
RUN abigen --abi=artifacts/contracts/MintBurnERC20.sol/MintBurnERC20.abi.json --pkg=contract --out=artifacts/contracts/MintBurnERC20.sol/MintBurnERC20.go --type=MintBurnERC20 |
Oops, something went wrong.