|
32 | 32 | build-windows-artifact: |
33 | 33 | name: build-windows-artifact |
34 | 34 | runs-on: windows-latest |
35 | | - needs: build-linux-artifact |
36 | 35 | steps: |
37 | 36 | - uses: actions/checkout@v2 |
38 | 37 | with: |
@@ -77,39 +76,87 @@ jobs: |
77 | 76 | with: |
78 | 77 | name: windows-binary |
79 | 78 | path: bin/gpu-miner_*.exe |
80 | | - |
81 | | - - name: Get linux artifact (Release prep) |
82 | | - if: startsWith(github.ref, 'refs/tags/') |
| 79 | + |
| 80 | + release: |
| 81 | + name: release |
| 82 | + runs-on: ubuntu-latest |
| 83 | + # If both artifacts were built properly and this is a tag |
| 84 | + if: ${{ needs.build-linux-artifact.result == 'success' && needs.build-linux-artifact.result == 'success' && startsWith(github.ref, 'refs/tags/') }} |
| 85 | + needs: [build-linux-artifact, build-windows-artifact] |
| 86 | + steps: |
| 87 | + - uses: actions/checkout@v2 |
| 88 | + |
| 89 | + - name: Get linux artifact |
83 | 90 | uses: actions/download-artifact@v2 |
84 | 91 | with: |
85 | 92 | name: linux-binary |
86 | | - path: bin/ |
| 93 | + |
| 94 | + - name: Get Windows artifact |
| 95 | + uses: actions/download-artifact@v2 |
| 96 | + with: |
| 97 | + name: windows-binary |
87 | 98 |
|
88 | 99 | - name: Get the version (Release prep) |
89 | | - if: startsWith(github.ref, 'refs/tags/') |
90 | 100 | id: get_version |
91 | 101 | run: | |
92 | 102 | version=$(echo ${GITHUB_REF/refs\/tags\//} | cut -c 2-) |
93 | 103 | echo ::set-output name=VERSION::$version |
94 | 104 | shell: bash |
95 | 105 |
|
96 | 106 | - name: Generate miners checksums (Release prep) |
97 | | - if: startsWith(github.ref, 'refs/tags/') |
98 | 107 | run: | |
99 | | - $fileName = git rev-parse --short HEAD |
100 | | - $hash = Get-FileHash -Algorithm SHA256 "bin/gpu-miner.exe" | Select -ExpandProperty "Hash" |
101 | | - Write-Output $hash.ToLower()"alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe" | Out-File -FilePath "bin\alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe.checksum" |
102 | | - mv "bin/gpu-miner.exe" "bin\alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe" |
103 | | - $hash = Get-FileHash -Algorithm SHA256 "bin\gpu-miner_$fileName" | Select -ExpandProperty "Hash" |
104 | | - Write-Output $hash.ToLower()"alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux" | Out-File -FilePath "bin\alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux.checksum" |
105 | | - mv "bin\gpu-miner_$fileName" "bin\alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux" |
106 | | - dir bin |
| 108 | + filename=$(git rev-parse --short HEAD) |
| 109 | + mv "gpu-miner_$filename" "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux" |
| 110 | + mv "gpu-miner_$filename.exe" "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe" |
| 111 | + sha256sum "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux" > "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux.checksum" |
| 112 | + sha256sum "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe" > "alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe.checksum" |
| 113 | + ls -la |
| 114 | + |
107 | 115 | - name: Release |
108 | 116 | uses: softprops/action-gh-release@v1 |
109 | | - if: startsWith(github.ref, 'refs/tags/') |
110 | 117 | with: |
111 | 118 | files: | |
112 | | - bin\alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux |
113 | | - bin\alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux.checksum |
114 | | - bin\alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe |
115 | | - bin\alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe.checksum |
| 119 | + alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux |
| 120 | + alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-linux.checksum |
| 121 | + alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe |
| 122 | + alephium-${{ steps.get_version.outputs.VERSION }}-cuda-miner-windows.exe.checksum |
| 123 | + |
| 124 | + buildx_and_push_to_registry: |
| 125 | + name: Push Docker image to Docker Hub |
| 126 | + runs-on: ubuntu-latest |
| 127 | + if: ${{ needs.release.result == 'success' }} |
| 128 | + needs: release |
| 129 | + steps: |
| 130 | + - name: Check out the repo |
| 131 | + uses: actions/checkout@v2 |
| 132 | + |
| 133 | + - uses: docker/setup-qemu-action@v1 |
| 134 | + - uses: docker/setup-buildx-action@v1 |
| 135 | + |
| 136 | + - name: Get the version |
| 137 | + id: get_version |
| 138 | + run: | |
| 139 | + version=$(git describe --tags --abbrev=0) |
| 140 | + echo $version |
| 141 | + echo ${version:1} |
| 142 | + echo ::set-output name=VERSION::$version |
| 143 | + echo ::set-output name=VERSION-NO-V::${version:1} |
| 144 | + shell: bash |
| 145 | + |
| 146 | + - name: Log in to Docker Hub |
| 147 | + uses: docker/login-action@v1 |
| 148 | + with: |
| 149 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 150 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 151 | + |
| 152 | + - name: Build and publish docker image |
| 153 | + uses: docker/build-push-action@v2 |
| 154 | + with: |
| 155 | + context: . |
| 156 | + file: ./Dockerfile |
| 157 | + build-args: RELEASE=${{ steps.get_version.outputs.VERSION-NO-V }} |
| 158 | + platforms: linux/amd64 |
| 159 | + tags: | |
| 160 | + docker.io/alephium/gpu-miner:${{ steps.get_version.outputs.VERSION }} |
| 161 | + docker.io/alephium/gpu-miner:latest |
| 162 | + push: true |
0 commit comments