From c8a2190606ba240f1a91ea604dd1b616fcac7d41 Mon Sep 17 00:00:00 2001 From: Tom Andrade Date: Wed, 18 May 2022 13:34:06 +0200 Subject: [PATCH 1/3] fix: http flag default value --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 0580313..8025717 100644 --- a/main.go +++ b/main.go @@ -64,7 +64,7 @@ func main() { addr = flag.String("addr", "localhost", "Address to listen for connections") domain = flag.String("domain", "localhost", "Domain to write to the URLs") path = flag.String("path", "", "Path to the base URL (https://localhost/PATH/...") - http = flag.Bool("http", true, "proto to the base URL (HTTPS://localhost/path/... no real https here just to set the url (for like a proxy offloading https") + http = flag.Bool("http", false, "proto to the base URL (HTTPS://localhost/path/... no real https here just to set the url (for like a proxy offloading https") port = flag.Int("port", 8080, "Port to listen for connections") exp = flag.Int("exp", 240, "Default expiration time in hours, default 240") cleanup = flag.Int("cleanup", 1, "Cleanup interval in hours, default 1") From 1982e6e731fbfc61622a9d5453a8dff5c21df855 Mon Sep 17 00:00:00 2001 From: Tom Andrade Date: Wed, 18 May 2022 13:41:55 +0200 Subject: [PATCH 2/3] fix: copy all repo files to docker build space --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 678d20b..38afda8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM golang:1.18 as builder ENV CGO_ENABLED=0 -ADD main.go go.* /go/src/short/ +COPY . /go/src/short/ WORKDIR /go/src/short From 6ac306e327adab7049ed9a25568b30b7d175ad5b Mon Sep 17 00:00:00 2001 From: Tom Andrade Date: Wed, 18 May 2022 13:42:21 +0200 Subject: [PATCH 3/3] feat: add builds --- .github/workflows/build-on-branch.yml | 21 +++++++++++++++++++++ .github/workflows/build-on-tag.yml | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/build-on-branch.yml create mode 100644 .github/workflows/build-on-tag.yml diff --git a/.github/workflows/build-on-branch.yml b/.github/workflows/build-on-branch.yml new file mode 100644 index 0000000..238b00a --- /dev/null +++ b/.github/workflows/build-on-branch.yml @@ -0,0 +1,21 @@ +name: Build tag + +on: + push: + branches: + - 'main' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: docker build . -t tandrade/short:$(echo $([[ $(git rev-parse --abbrev-ref HEAD) == master ]] && echo latest || echo latest-modsec)) + - name: Login + uses: docker/login-action@v1.10.0 + with: + username: tandrade + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Push + run: docker push tandrade/short:$(echo $([[ $(git rev-parse --abbrev-ref HEAD) == master ]] && echo latest || echo latest-modsec)) diff --git a/.github/workflows/build-on-tag.yml b/.github/workflows/build-on-tag.yml new file mode 100644 index 0000000..f07f961 --- /dev/null +++ b/.github/workflows/build-on-tag.yml @@ -0,0 +1,21 @@ +name: Build tag + +on: + create: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Build + run: docker build . -t tandrade/short:${GITHUB_REF/refs\/tags\//} + - name: Login + uses: docker/login-action@v1.10.0 + with: + username: tandrade + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Push + run: docker push tandrade/short:${GITHUB_REF/refs\/tags\//}