|
| 1 | +name: Build and Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + pull_request: |
| 7 | + branches: [] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: ubuntu-20.04 |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v2 |
| 16 | + with: |
| 17 | + submodules: 'true' |
| 18 | + |
| 19 | + - name: Install build-essential, curl, git, wget, and Docker |
| 20 | + run: | |
| 21 | + sudo apt-get update |
| 22 | + sudo apt-get install -y build-essential curl git wget |
| 23 | + sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common |
| 24 | + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| 25 | + sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
| 26 | + sudo apt-get update |
| 27 | + sudo apt-get install -y docker-ce docker-ce-cli containerd.io |
| 28 | + echo "Installed build-essential, curl, git, wget, and Docker" |
| 29 | +
|
| 30 | + - name: Setup Rust and Cargo |
| 31 | + uses: actions-rs/toolchain@v1 |
| 32 | + with: |
| 33 | + toolchain: 1.51.0 |
| 34 | + override: true |
| 35 | + components: rustc, cargo |
| 36 | + |
| 37 | + - name: Build app |
| 38 | + run: sh build.sh |
| 39 | + |
| 40 | + - name: Upload artifact |
| 41 | + uses: actions/upload-artifact@v2 |
| 42 | + with: |
| 43 | + name: dist |
| 44 | + path: ./dist/ |
| 45 | + |
| 46 | + release: |
| 47 | + needs: build |
| 48 | + runs-on: ubuntu-22.04 |
| 49 | + |
| 50 | + steps: |
| 51 | + - name: Checkout code |
| 52 | + uses: actions/checkout@v2 |
| 53 | + |
| 54 | + - name: Download build artifact |
| 55 | + uses: actions/download-artifact@v2 |
| 56 | + with: |
| 57 | + name: dist |
| 58 | + path: ./dist |
| 59 | + |
| 60 | + - name: Prepare release |
| 61 | + run: zip -r dist.zip dist |
| 62 | + |
| 63 | + - name: Get the current date |
| 64 | + id: date |
| 65 | + run: echo "::set-output name=date::$(date +'%Y-%m-%d-%H-%M')" |
| 66 | + |
| 67 | + - name: Create new release |
| 68 | + id: create_release |
| 69 | + uses: actions/create-release@v1 |
| 70 | + env: |
| 71 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 72 | + with: |
| 73 | + tag_name: ${{ steps.date.outputs.date }} |
| 74 | + release_name: "Release: ${{ steps.date.outputs.date }}" |
| 75 | + draft: false |
| 76 | + prerelease: false |
| 77 | + body: "Hackachain phase 2 bn256 release at ${{ steps.date.outputs.date }}" |
| 78 | + |
| 79 | + - name: Upload Release Asset |
| 80 | + uses: actions/upload-release-asset@v1 |
| 81 | + env: |
| 82 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + with: |
| 84 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 85 | + asset_name: dist.zip |
| 86 | + asset_path: ./dist.zip |
| 87 | + asset_content_type: application/zip |
0 commit comments