Move to GitLab

This commit is contained in:
2021-11-20 22:08:05 +00:00
parent ebf0988f7d
commit 7b7d706681
5 changed files with 66 additions and 0 deletions

63
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,63 @@
stages:
- build-docker
- build-binary
- upload
- release
build-docker:
stage: build-docker
only:
- tags
image: docker:19.03.12
services:
- docker:19.03.12-dind
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:latest -t $IMAGE_TAG .
- docker build -t $IMAGE_TAG -t $CI_REGISTRY_IMAGE:latest .
- docker push $IMAGE_TAG
- docker push $CI_REGISTRY_IMAGE:latest
build-binary:
stage: build-binary
image: golang:1.17.3
before_script:
- cd $GOPATH/src
- mkdir -p gitlab.com/$CI_PROJECT_NAMESPACE
- cd gitlab.com/$CI_PROJECT_NAMESPACE
- ln -s $CI_PROJECT_DIR
- cd $CI_PROJECT_NAME
script:
- CGO_ENABLED=0 GOARCH=amd64 GOOS=darwin go build -o iPilot-${CI_COMMIT_TAG}-darwin-amd64
- CGO_ENABLED=0 GOARCH=arm64 GOOS=darwin go build -o iPilot-${CI_COMMIT_TAG}-darwin-arm64
- CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o iPilot-${CI_COMMIT_TAG}-linux-amd64
- CGO_ENABLED=0 GOARCH=amd64 GOOS=windows go build -o iPilot-${CI_COMMIT_TAG}-win-amd64.exe
- CGO_ENABLED=0 GOARCH=386 GOOS=windows go build -o iPilot-${CI_COMMIT_TAG}-win-x86.exe
upload:
stage: upload
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
script:
- curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file iPilot-${CI_COMMIT_TAG}-darwin-amd64 ${PACKAGE_REGISTRY_URL}
- curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file iPilot-${CI_COMMIT_TAG}-darwin-arm64 ${PACKAGE_REGISTRY_URL}
- curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file iPilot-${CI_COMMIT_TAG}-linux-amd64 ${PACKAGE_REGISTRY_URL}
- curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file iPilot-${CI_COMMIT_TAG}-win-amd64.exe ${PACKAGE_REGISTRY_URL}
- curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file iPilot-${CI_COMMIT_TAG}-win-x86.exe ${PACKAGE_REGISTRY_URL}
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:v0.4.0
rules:
- if: $CI_COMMIT_TAG
script:
- |
release-cli create --name "$CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"iPilot-${CI_COMMIT_TAG}-darwin-amd64\",\"url\":\"iPilot-${CI_COMMIT_TAG}-darwin-amd64\"}" \
--assets-link "{\"name\":\"iPilot-${CI_COMMIT_TAG}-darwin-arm64\",\"url\":\"iPilot-${CI_COMMIT_TAG}-darwin-arm64\"}" \
--assets-link "{\"name\":\"iPilot-${CI_COMMIT_TAG}-linux-amd64\",\"url\":\"iPilot-${CI_COMMIT_TAG}-linux-amd64\"}" \
--assets-link "{\"name\":\"iPilot-${CI_COMMIT_TAG}-win-amd64.exe\",\"url\":\"iPilot-${CI_COMMIT_TAG}-win-amd64.exe\"}" \
--assets-link "{\"name\":\"iPilot-${CI_COMMIT_TAG}-win-x86.exe\",\"url\":\"iPilot-${CI_COMMIT_TAG}-win-x86.exe\"}"

View File

@@ -16,5 +16,8 @@ Here are some ways that you can run the script:
| `./iPilot -i google.com` | Run against the domain name `google.com` |
| `./iPilot -i google.com -p` | Run against the domain name `google.com` and lists BGP prefixes |
## Support
For support please open an issue on [GitLab](https://gitlab.com/luketainton/iPilot) or email [ipilot@help.tainton.uk](mailto:ipilot@help.tainton.uk).
## Credits
This script runs thanks to the APIs provided by [IP-API](http://ip-api.com) and [HackerTarget](https://hackertarget.com/as-ip-lookup).