diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..3c8aeb5 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,60 @@ +name: build +on: [push, pull_request] + +jobs: + gotify: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: 1.15.x + - uses: actions/setup-node@v1 + - uses: actions/cache@v2 + with: + path: ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - uses: actions/cache@v2 + with: + path: | + ui/node_modules + key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }} + restore-keys: ${{ runner.os }}-node_modules- + - uses: actions/checkout@v2 + - uses: golangci/golangci-lint-action@v2 + with: + version: v1.31 + - run: go mod download + - run: make download-tools + - run: (cd ui && yarn) + - run: make build-js + - run: make embed-static + - run: make test + - run: make check-ci + - uses: codecov/codecov-action@v1 + - if: startsWith(github.ref, 'refs/tags/v') + run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV + - if: startsWith(github.ref, 'refs/tags/v') + run: | + export LD_FLAGS="-w -s -X main.Version=$VERSION -X main.BuildDate=$(date "+%F-%T") -X main.Commit=$(git rev-parse --verify HEAD) -X main.Mode=prod" + make build + sudo chown -R $UID build + make package-zip + ls -lath build + make build-docker + docker image ls + echo "$DOCKER_PASS" | docker login --username "$DOCKER_USER" --password-stdin + docker push gotify/server + docker push gotify/server-arm7 + env: + DOCKER_USER: ${{ secrets.DOCKER_USER }} + DOCKER_PASS: ${{ secrets.DOCKER_PASS }} + - if: startsWith(github.ref, 'refs/tags/v') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/*.zip + tag: ${{ github.ref }} + overwrite: true + file_glob: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 097edfa..0000000 --- a/.travis.yml +++ /dev/null @@ -1,63 +0,0 @@ -language: go -sudo: required - -notifications: - email: false - -services: - - docker - -env: - - GO111MODULE=on - -cache: - directories: - - $HOME/gopath/pkg/mod - -before_install: - - nvm install 12.10.0 - - export GIMME_GO=$(< GO_VERSION) - - eval "$(gimme ${GIMME_GO%.0})"; - - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.31.0 - - make download-tools - -install: - - go get - - (cd ui && yarn) - -script: - - make build-js - - make embed-static - - make test - - make check - -after_success: - - bash <(curl -s https://codecov.io/bash) - -before_deploy: - - > - if ! [ "$BEFORE_DEPLOY_RUN" ]; then - export BEFORE_DEPLOY_RUN=1; - if [[ $TRAVIS_TAG != "v"* ]]; then exit 1; fi; - export VERSION=$(echo $TRAVIS_TAG | cut -c 2-); - export LD_FLAGS="-w -s -X main.Version=${VERSION} -X main.BuildDate=$(date "+%F-%T") -X main.Commit=$(git rev-parse --verify HEAD) -X main.Mode=prod"; - make build - sudo chown -R travis:travis build - make package-zip; - ls -lath build; - make build-docker; - fi - -deploy: - - provider: releases - api_key: $GH_TOKEN - file_glob: true - file: build/*.zip - skip_cleanup: true - on: - tags: true - - provider: script - script: bash docker-push.sh - skip_cleanup: true - on: - tags: true diff --git a/README.md b/README.md index d23265b..b11d387 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@

gotify/server

- - Build Status + + Build Status codecov diff --git a/docker-push.sh b/docker-push.sh deleted file mode 100644 index 17aaf6e..0000000 --- a/docker-push.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; -docker push gotify/server -docker push gotify/server-arm7