-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding tls, docker build and new Pipelines * Updating pipelines * Fixing action versions, and doing cleanup. * Restructure flags, and more pipelien fun * Yet more pipelien fun
- Loading branch information
Showing
9 changed files
with
409 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: publish-main | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
publish-docker-image: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
IMAGE_NAME: ghcr.io/thorsager/surl | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Prepare | ||
id: prep | ||
run: | | ||
echo ::set-output name=tags::${IMAGE_NAME}:latest | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: all | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build | ||
uses: docker/build-push-action@v3 | ||
with: | ||
builder: ${{ steps.buildx.outputs.name }} | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7 | ||
push: true | ||
tags: ${{ steps.prep.outputs.tags }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | ||
|
||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: publish-on-branch | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- 'main' | ||
tags-ignore: | ||
- '*' | ||
|
||
jobs: | ||
publish-docker-image: | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_NAME: ghcr.io/thorsager/surl | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Prepare | ||
id: prep | ||
run: | | ||
echo ::set-output name=tags::${IMAGE_NAME}:${GITHUB_REF##*/} | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: all | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build | ||
uses: docker/build-push-action@v3 | ||
with: | ||
builder: ${{ steps.buildx.outputs.name }} | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7 | ||
push: true | ||
tags: ${{ steps.prep.outputs.tags }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | ||
|
||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: publish-on-tag | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- '**' | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
publish-docker-image: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
IMAGE_NAME: ghcr.io/thorsager/surl | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Prepare | ||
id: prep | ||
run: | | ||
echo ::set-output name=tags::${IMAGE_NAME}:${GITHUB_REF/refs\/tags\//} | ||
- name: Cache Docker layers | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: all | ||
|
||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
builder: ${{ steps.buildx.outputs.name }} | ||
context: . | ||
file: ./Dockerfile | ||
platforms: linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7 | ||
push: true | ||
tags: ${{ steps.prep.outputs.tags }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new | ||
|
||
- name: Move cache | ||
run: | | ||
rm -rf /tmp/.buildx-cache | ||
mv /tmp/.buildx-cache-new /tmp/.buildx-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
.DS_Store | ||
**/*~ | ||
.env | ||
.idea | ||
bin/ | ||
|
||
# Ignore Certificates | ||
*.crt | ||
*.pem | ||
*.key | ||
*.csr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,33 @@ | ||
binary=bin/surl | ||
version=$(shell git describe --tags --always --dirty) | ||
image=ghcr.io/thorsager/surl | ||
image_tag=$(version) | ||
|
||
.PHONY: surl | ||
surl: | ||
|
||
.PHONY: all | ||
all: test build | ||
|
||
build: get | ||
go build -v -a -tags netgo --ldflags='-X main.version=$(version)' -o $(binary) ./... | ||
|
||
.PHONY: url | ||
.PHONY: test | ||
test: | ||
go test -v ./... | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf bin | ||
|
||
.PHONY: image | ||
image: | ||
docker build -t $(image):$(image_tag) . | ||
|
||
.PHONY: get | ||
get: | ||
go get -v -t ./... | ||
|
||
|
||
.PHONY: snakeoil | ||
snakeoil: | ||
openssl req -new -newkey rsa:2048 -nodes -keyout localhost.key -out localhost.csr | ||
openssl x509 -req -days 365 -in localhost.csr -signkey localhost.key -out localhost.crt |
Oops, something went wrong.