Quellcode durchsuchen

chore(ghactions): rpm and deb repo generation on release

Mustafa Arici vor 5 Jahren
Ursprung
Commit
3b0d9847f8
3 geänderte Dateien mit 66 neuen und 5 gelöschten Zeilen
  1. 1 1
      .github/workflows/go.yml
  2. 61 0
      .github/workflows/release.yml
  3. 4 4
      Makefile

+ 1 - 1
.github/workflows/go.yml

@@ -15,7 +15,7 @@ jobs:
     - name: Set up Go
       uses: actions/setup-go@v2-beta
       with:
-        go-version: "^1.14.0"
+        go-version: "^1.14.6"
       id: go
 
     - name: Check out code

+ 61 - 0
.github/workflows/release.yml

@@ -0,0 +1,61 @@
+name: Release
+on:
+  push:
+    tags:
+      - 'v*'
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-go@v2
+        with:
+          go-version: '^1.14.6'
+
+      - name: Get the version
+        id: get_version
+        run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
+
+      - name: Repo Tools
+        run: |
+          sudo apt-get update -y
+          sudo apt install reprepro createrepo rsync -y
+          mkdir -p /tmp/protoc
+          pushd /tmp/protoc
+          wget https://github.com/protocolbuffers/protobuf/releases/download/v3.12.3/protoc-3.12.3-linux-x86_64.zip
+          unzip protoc-3.12.3-linux-x86_64.zip
+          popd
+          sudo chmod +x /tmp/protoc/bin/protoc
+          sudo cp /tmp/protoc/bin/protoc /usr/bin/protoc
+          sudo cp -r /tmp/protoc/include/* /usr/local/include/
+          sudo chmod -R 777 /usr/local/include/google
+          sudo apt-get install autoconf automake libtool curl make g++ unzip -y
+          go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
+          go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
+          go get -u github.com/golang/protobuf/protoc-gen-go
+          go get github.com/kevinburke/go-bindata/...
+          go get github.com/goreleaser/nfpm/cmd/nfpm@latest
+          ls `go env GOPATH`
+      - name: Dist
+        run: VERSION=${{ steps.get_version.outputs.VERSION }} make dist
+
+      - name: Make DEB Repo
+        run: |
+          mkdir -p ./repo/deb/conf
+          cp ./contrib/deb-repo-config ./repo/deb/conf/distributions
+          cp ./dist/*.deb ./repo/deb
+          reprepro -b ./repo/deb/ includedeb ovpm ./repo/deb/*.deb
+
+      - name: Make RPM Repo
+        run: |
+          mkdir -p ./repo/rpm/
+          cp ./contrib/yumrepo.repo ./repo/rpm/ovpm.repo
+          cp ./dist/*.rpm ./repo/rpm
+          createrepo --database ./repo/rpm
+
+      - name: Publish to GithubPages
+        uses: JamesIves/github-pages-deploy-action@3.5.7
+        with:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          BRANCH: gh-pages
+          FOLDER: repo

+ 4 - 4
Makefile

@@ -8,7 +8,7 @@ development-deps:
 	# grpc related dependencies
 	go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
 	go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
-	go get -u github.com/golang/protobuf/protoc-gen-go
+	go get -u github.com/golang/protobuf/protoc-gen-go/...
 
 	# static asset bundling
 	go get github.com/kevinburke/go-bindata/...
@@ -24,8 +24,8 @@ test:
 	go test -count=1 -race -coverprofile=coverage.txt -covermode=atomic .
 
 proto:
-	protoc -I api/pb/ -I$(shell go env GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis api/pb/user.proto api/pb/vpn.proto api/pb/network.proto api/pb/auth.proto --go_out=plugins=grpc:api/pb	
-	protoc -I api/pb/ -I$(shell go env GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis api/pb/user.proto api/pb/vpn.proto api/pb/network.proto api/pb/auth.proto --grpc-gateway_out=logtostderr=true:api/pb
+	protoc -I/usr/local/include -I api/pb/ -I/usr/local/include -I$(shell go list -m -f "{{.Dir}}" github.com/grpc-ecosystem/grpc-gateway)/third_party/googleapis api/pb/user.proto api/pb/vpn.proto api/pb/network.proto api/pb/auth.proto --grpc-gateway_out=logtostderr=true:api/pb
+	protoc -I/usr/local/include -I api/pb/ -I/usr/local/include -I$(shell go list -m -f "{{.Dir}}" github.com/grpc-ecosystem/grpc-gateway)/third_party/googleapis api/pb/user.proto api/pb/vpn.proto api/pb/network.proto api/pb/auth.proto --go_out=plugins=grpc:api/pb
 
 clean-bundle:
 	@echo Cleaning up bundle/
@@ -39,7 +39,7 @@ bundle-webui:
 	cp -r webui/ovpm/build/* bundle
 
 bundle-swagger: proto
-	protoc -I api/pb/ -I$(shell go env GOPATH)/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis api/pb/user.proto api/pb/vpn.proto api/pb/network.proto api/pb/auth.proto --swagger_out=logtostderr=true:bundle
+	protoc -I/usr/local/include -I api/pb/  -I/usr/local/include -I$(shell go list -m -f "{{.Dir}}" github.com/grpc-ecosystem/grpc-gateway)/third_party/googleapis api/pb/user.proto api/pb/vpn.proto api/pb/network.proto api/pb/auth.proto --swagger_out=logtostderr=true:bundle
 
 bundle: clean-bundle bundle-webui bundle-swagger
 	go-bindata -pkg bundle -o bundle/bindata.go bundle/...