|
| 1 | +name: Nightly |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: 0 0 * * * |
| 6 | + |
| 7 | +permissions: |
| 8 | + actions: write |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + linux: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v3 |
| 17 | + |
| 18 | + - name: Install Crystal |
| 19 | + uses: crystal-lang/install-crystal@v1 |
| 20 | + with: |
| 21 | + crystal: latest |
| 22 | + |
| 23 | + - name: Install Dependencies |
| 24 | + run: shards install --production |
| 25 | + |
| 26 | + - name: Compile Binaries |
| 27 | + run: | |
| 28 | + crystal build src/main.cr -o geode |
| 29 | + tar -zcf geode-nightly-linux-x86_64.tar.gz geode |
| 30 | +
|
| 31 | + - name: Upload Artifacts |
| 32 | + uses: actions/upload-artifact@v3 |
| 33 | + with: |
| 34 | + name: geode |
| 35 | + path: | |
| 36 | + geode |
| 37 | + geode-nightly-linux-x86_64.tar.gz |
| 38 | +
|
| 39 | + windows: |
| 40 | + needs: linux |
| 41 | + runs-on: windows-latest |
| 42 | + steps: |
| 43 | + - name: Checkout |
| 44 | + uses: actions/checkout@v3 |
| 45 | + |
| 46 | + - name: Install Crystal |
| 47 | + uses: crystal-lang/install-crystal@v1 |
| 48 | + with: |
| 49 | + crystal: latest |
| 50 | + |
| 51 | + - name: Install Dependencies |
| 52 | + run: shards install --production |
| 53 | + |
| 54 | + - name: Compile Binaries |
| 55 | + run: | |
| 56 | + crystal build src\main.cr -o geode.exe |
| 57 | + $compress = @{ |
| 58 | + Path = "geode.exe", "geode.pdb" |
| 59 | + DestinationPath = "geode-nightly-windows-x86_64-msvc.zip" |
| 60 | + } |
| 61 | + Compress-Archive @compress |
| 62 | +
|
| 63 | + - name: Upload Artifacts |
| 64 | + uses: actions/upload-artifact@v3 |
| 65 | + with: |
| 66 | + name: geode |
| 67 | + path: | |
| 68 | + geode.exe |
| 69 | + geode.pdb |
| 70 | + geode-nightly-windows-x86_64-msvc.zip |
| 71 | +
|
| 72 | + release: |
| 73 | + needs: windows |
| 74 | + runs-on: ubuntu-latest |
| 75 | + steps: |
| 76 | + - name: Checkout |
| 77 | + uses: actions/checkout@v3 |
| 78 | + |
| 79 | + - name: Download Artifacts |
| 80 | + uses: actions/download-artifact@v3 |
| 81 | + with: |
| 82 | + path: artifacts/ |
| 83 | + |
| 84 | + - name: Prepare Artifacts |
| 85 | + run: | |
| 86 | + mv artifacts/geode/* . |
| 87 | + sha256sum geode geode.exe geode.pdb > checksums.txt |
| 88 | +
|
| 89 | + - name: Create Release |
| 90 | + env: |
| 91 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 92 | + |
| 93 | + run: | |
| 94 | + gh release view nightly &>/dev/null && gh release delete nightly -y |
| 95 | + gh release create nightly -pt Nightly --notes "Nightly release for $(date +%F)." |
| 96 | + gh release upload nightly checksums.txt |
| 97 | + gh release upload nightly geode-nightly-linux-x86_64.tar.gz |
| 98 | + gh release upload nightly geode-nightly-windows-x86_64-msvc.zip |
0 commit comments