diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..052488f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,280 @@ +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]*' + +name: Create release and upload binaries + +jobs: + build-linux: + name: Build Linux All + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build + run: | + make BUILD_NUMBER="${GITHUB_REF#refs/tags/v}" release-linux + mkdir release + mv build/*.tar.gz release + + - name: Upload artifacts + uses: actions/upload-artifact@v1 + with: + name: linux-latest + path: release + + build-windows: + name: Build Windows amd64 + runs-on: windows-latest + steps: + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build + run: | + echo $Env:GITHUB_REF.Substring(11) + go build -trimpath -ldflags "-X main.Build=$($Env:GITHUB_REF.Substring(11))" -o build\nebula.exe ./cmd/nebula-service + go build -trimpath -ldflags "-X main.Build=$($Env:GITHUB_REF.Substring(11))" -o build\nebula-cert.exe ./cmd/nebula-cert + + - name: Upload artifacts + uses: actions/upload-artifact@v1 + with: + name: windows-latest + path: build + + build-darwin: + name: Build Darwin amd64 + runs-on: macOS-latest + steps: + - name: Set up Go 1.13 + uses: actions/setup-go@v1 + with: + go-version: 1.13 + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build + run: | + make BUILD_NUMBER="${GITHUB_REF#refs/tags/v}" service build/nebula-darwin-amd64.tar.gz + mkdir release + mv build/*.tar.gz release + + - name: Upload artifacts + uses: actions/upload-artifact@v1 + with: + name: darwin-latest + path: release + + release: + name: Create and Upload Release + needs: [build-linux, build-darwin, build-windows] + runs-on: ubuntu-latest + steps: + - name: Download Linux artifacts + uses: actions/download-artifact@v1 + with: + name: linux-latest + + - name: Download Darwin artifacts + uses: actions/download-artifact@v1 + with: + name: darwin-latest + + - name: Download Windows artifacts + uses: actions/download-artifact@v1 + with: + name: windows-latest + + - name: Zip Windows + run: | + cd windows-latest + zip nebula-windows-amd64.zip nebula.exe nebula-cert.exe + + - name: Create sha256sum + run: | + for dir in linux-latest darwin-latest windows-latest + do + ( + cd $dir + if [ "$dir" = windows-latest ] + then + sha256sum