Migrate to github actions
This commit is contained in:
parent
5016adcc42
commit
1eecb53c4b
|
|
@ -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
|
||||||
63
.travis.yml
63
.travis.yml
|
|
@ -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
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
<h1 align="center">gotify/server</h1>
|
<h1 align="center">gotify/server</h1>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://travis-ci.org/gotify/server">
|
<a href="https://github.com/gotify/server/actions?query=workflow%3Abuild">
|
||||||
<img alt="Build Status" src="https://travis-ci.org/gotify/server.svg?branch=master">
|
<img alt="Build Status" src="https://github.com/gotify/server/workflows/build/badge.svg">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://codecov.io/gh/gotify/server">
|
<a href="https://codecov.io/gh/gotify/server">
|
||||||
<img alt="codecov" src="https://codecov.io/gh/gotify/server/branch/master/graph/badge.svg">
|
<img alt="codecov" src="https://codecov.io/gh/gotify/server/branch/master/graph/badge.svg">
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
Loading…
Reference in New Issue