This commit is contained in:
parent
b7f4d06731
commit
392341cf38
|
@ -5,7 +5,7 @@
|
||||||
tasks:
|
tasks:
|
||||||
- name: Copy build to remote
|
- name: Copy build to remote
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: ../build/sour.is-paste
|
src: ../sour.is-paste
|
||||||
dest: /usr/local/bin/sour.is-paste
|
dest: /usr/local/bin/sour.is-paste
|
||||||
mode: u=rwx,g=rx,o=rx
|
mode: u=rwx,g=rx,o=rx
|
||||||
owner: root
|
owner: root
|
||||||
|
|
|
@ -2,7 +2,7 @@ name: Deploy
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main", "master" ]
|
branches: [ "master" ]
|
||||||
release:
|
release:
|
||||||
types: [ published ]
|
types: [ published ]
|
||||||
|
|
||||||
|
@ -11,10 +11,6 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
fetch-tags: true
|
|
||||||
|
|
||||||
- run: apt-get update && apt-get -y install ansible
|
- run: apt-get update && apt-get -y install ansible
|
||||||
|
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
|
@ -22,15 +18,17 @@ jobs:
|
||||||
with:
|
with:
|
||||||
go-version: 1.21.1
|
go-version: 1.21.1
|
||||||
|
|
||||||
- name: Build
|
- name: Install
|
||||||
run: go build -ldflags "-s -w" -o ./build/sour.is-paste ./cmd/paste
|
run: go install -ldflags "-s -w" go.sour.is/paste/cmd/paste@latest
|
||||||
|
|
||||||
|
- run: mv $(go env GOPATH)/bin/paste sour.is-paste
|
||||||
|
|
||||||
- name: Compress
|
- name: Compress
|
||||||
uses: https://git.sour.is/actions/ghaction-upx@v2.4.0
|
uses: https://git.sour.is/actions/ghaction-upx@v2.4.0
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
files: |
|
files: |
|
||||||
./build/sour.is-paste
|
./sour.is-paste
|
||||||
args: -fq
|
args: -fq
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -37,7 +37,7 @@ run:
|
||||||
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(DOCS_ASSET)
|
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(DOCS_ASSET)
|
||||||
go build -v \
|
go build -v \
|
||||||
-ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)" \
|
-ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)" \
|
||||||
"sour.is/x/paste/cmd/paste"
|
"go.sour.is/paste/cmd/paste"
|
||||||
|
|
||||||
clean-ui:
|
clean-ui:
|
||||||
rm -rf $(ROUTE_ASSET) $(DOCS_ASSET)
|
rm -rf $(ROUTE_ASSET) $(DOCS_ASSET)
|
||||||
|
@ -47,12 +47,12 @@ $(ROUTE_ASSET):
|
||||||
rm -rf build ../public; \
|
rm -rf build ../public; \
|
||||||
npm i; npm run build; \
|
npm i; npm run build; \
|
||||||
cp -r build ../public
|
cp -r build ../public
|
||||||
go generate "sour.is/x/paste/src/routes"
|
go generate "go.sour.is/paste/src/routes"
|
||||||
|
|
||||||
$(DOCS_ASSET):
|
$(DOCS_ASSET):
|
||||||
echo "$$DUMMY_BINDATA" > src/docs/bindata.go
|
echo "$$DUMMY_BINDATA" > src/docs/bindata.go
|
||||||
go generate "sour.is/x/paste/cmd/paste"
|
go generate "go.sour.is/paste/cmd/paste"
|
||||||
go generate "sour.is/x/paste/src/docs"
|
go generate "go.sour.is/paste/src/docs"
|
||||||
|
|
||||||
deploy: $(SOURCE) $(ROUTE_ASSET)
|
deploy: $(SOURCE) $(ROUTE_ASSET)
|
||||||
cd debian && make
|
cd debian && make
|
||||||
|
|
|
@ -24,15 +24,15 @@
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// swagger:meta
|
// swagger:meta
|
||||||
package main // import "sour.is/x/paste/cmd/paste"
|
package main // import "go.sour.is/paste/cmd/paste"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
_ "sour.is/x/paste/src/docs"
|
_ "go.sour.is/paste/src/docs"
|
||||||
_ "sour.is/x/paste/src/routes"
|
_ "go.sour.is/paste/src/routes"
|
||||||
"sour.is/x/toolbox/httpsrv"
|
"sour.is/x/toolbox/httpsrv"
|
||||||
"sour.is/x/toolbox/log"
|
"sour.is/x/toolbox/log"
|
||||||
)
|
)
|
||||||
|
|
2
debian/Makefile
vendored
2
debian/Makefile
vendored
|
@ -25,7 +25,7 @@ build:
|
||||||
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
|
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
|
||||||
env GOOS=linux GOARCH=amd64 go build -v -o $${BUILD}/opt/sour.is/bin/paste \
|
env GOOS=linux GOARCH=amd64 go build -v -o $${BUILD}/opt/sour.is/bin/paste \
|
||||||
-ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)"\
|
-ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)"\
|
||||||
sour.is/x/paste/cmd/paste && \
|
go.sour.is/paste/cmd/paste && \
|
||||||
dpkg -b $${BUILD}
|
dpkg -b $${BUILD}
|
||||||
|
|
||||||
copy:
|
copy:
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.uber.org/ratelimit"
|
"go.uber.org/ratelimit"
|
||||||
"sour.is/x/paste/src/pkg/cache"
|
"go.sour.is/paste/src/pkg/cache"
|
||||||
"sour.is/x/toolbox/log"
|
"sour.is/x/toolbox/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"sour.is/x/paste/src/pkg/readutil"
|
"go.sour.is/paste/src/pkg/readutil"
|
||||||
"sour.is/x/toolbox/httpsrv"
|
"sour.is/x/toolbox/httpsrv"
|
||||||
"sour.is/x/toolbox/log"
|
"sour.is/x/toolbox/log"
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ import (
|
||||||
"github.com/tv42/zbase32"
|
"github.com/tv42/zbase32"
|
||||||
"golang.org/x/crypto/openpgp/armor"
|
"golang.org/x/crypto/openpgp/armor"
|
||||||
|
|
||||||
"sour.is/x/paste/src/pkg/cache"
|
"go.sour.is/paste/src/pkg/cache"
|
||||||
"sour.is/x/paste/src/pkg/promise"
|
"go.sour.is/paste/src/pkg/promise"
|
||||||
"sour.is/x/toolbox/httpsrv"
|
"sour.is/x/toolbox/httpsrv"
|
||||||
"sour.is/x/toolbox/log"
|
"sour.is/x/toolbox/log"
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
"sour.is/x/toolbox/httpsrv"
|
"sour.is/x/toolbox/httpsrv"
|
||||||
"sour.is/x/toolbox/log"
|
"sour.is/x/toolbox/log"
|
||||||
|
|
||||||
"sour.is/x/paste/src/pkg/readutil"
|
"go.sour.is/paste/src/pkg/readutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
@ -17,7 +17,7 @@ import (
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
"sour.is/x/paste/src/pkg/readutil"
|
"go.sour.is/paste/src/pkg/readutil"
|
||||||
"sour.is/x/toolbox/httpsrv"
|
"sour.is/x/toolbox/httpsrv"
|
||||||
"sour.is/x/toolbox/log"
|
"sour.is/x/toolbox/log"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user