diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..c1d8194 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,61 @@ +version: '{build}' +image: 'Visual Studio 2017' +platform: x64 + +max_jobs: 1 + +environment: + GOPATH: c:\go + docker_username: + secure: em/TNLUXxG19O/HvbvfJuQ== + docker_password: + secure: Yo9FJJqihaNz5q8T4Jz8tQ== + +branches: + only: + - master + +install: + - ps: | + docker version + go version + go env + +build_script: + - ps: | + if ( $env:APPVEYOR_REPO_TAG -eq 'false' ) { + $version = $env:APPVEYOR_REPO_COMMIT + } else { + $version = $env:APPVEYOR_REPO_TAG_NAME + } + go build -ldflags "-X main.Version=$version" -a -o release/drone-telegram.exe . + + docker pull microsoft/nanoserver:10.0.14393.1884 + docker build -f docker/Dockerfile.windows.amd64 -t appleboy/drone-telegram:windows-amd64 . + +test_script: + - ps: | + docker run --rm appleboy/drone-telegram:windows-amd64 --version + +deploy_script: + - ps: | + $ErrorActionPreference = 'Stop'; + if ( $env:APPVEYOR_PULL_REQUEST_NUMBER ) { + Write-Host Nothing to deploy. + } else { + echo $env:DOCKER_PASSWORD | docker login --username $env:DOCKER_USERNAME --password-stdin + if ( $env:APPVEYOR_REPO_TAG -eq 'true' ) { + $major,$minor,$patch = $env:APPVEYOR_REPO_TAG_NAME.split('.') + docker push appleboy/drone-telegram:windows-amd64 + docker tag appleboy/drone-telegram:windows-amd64 appleboy/drone-telegram:$major.$minor.$patch-windows-amd64 + docker push appleboy/drone-telegram:$major.$minor.$patch-windows-amd64 + docker tag appleboy/drone-telegram:windows-amd64 appleboy/drone-telegram:$major.$minor-windows-amd64 + docker push appleboy/drone-telegram:$major.$minor-windows-amd64 + docker tag appleboy/drone-telegram:windows-amd64 appleboy/drone-telegram:$major-windows-amd64 + docker push appleboy/drone-telegram:$major-windows-amd64 + } else { + if ( $env:APPVEYOR_REPO_BRANCH -eq 'master' ) { + docker push appleboy/drone-telegram:windows-amd64 + } + } + } diff --git a/.drone.windows.yml b/.drone.windows.yml deleted file mode 100644 index 54a16a8..0000000 --- a/.drone.windows.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -kind: pipeline -name: windows-amd64 - -platform: - os: windows - arch: amd64 - -steps: - - name: build-push - pull: always - image: golang:1.11 - commands: - - 'go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/windows/amd64/drone-telegram' - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - push - - pull_request - - - name: build-tag - pull: always - image: golang:1.11 - commands: - - 'go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/windows/amd64/drone-telegram' - environment: - CGO_ENABLED: 0 - GO111MODULE: on - when: - event: - - tag - - - name: executable - pull: always - image: golang:1.11 - commands: - - ./release/windows/amd64/drone-telegram --help - - - name: dryrun - pull: always - image: plugins/docker:windows-amd64 - settings: - dockerfile: docker/Dockerfile.windows.amd64 - dry_run: true - password: - from_secret: docker_password - repo: appleboy/drone-telegram - tags: windows-amd64 - username: - from_secret: docker_username - when: - event: - - pull_request - - - name: publish - pull: always - image: plugins/docker:windows-amd64 - settings: - auto_tag: true - auto_tag_suffix: windows-amd64 - dockerfile: docker/Dockerfile.windows.amd64 - password: - from_secret: docker_password - repo: appleboy/drone-telegram - username: - from_secret: docker_username - when: - event: - - push - - tag - -trigger: - branch: - - master diff --git a/docker/Dockerfile.windows b/docker/Dockerfile.windows.amd64 similarity index 100% rename from docker/Dockerfile.windows rename to docker/Dockerfile.windows.amd64 diff --git a/go.mod b/go.mod index 942a297..8f51f17 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/appleboy/drone-telegram +go 1.11 + require ( github.com/appleboy/drone-facebook v1.4.0 github.com/aymerick/raymond v2.0.2+incompatible // indirect