mirror of
https://github.com/gotify/server.git
synced 2024-01-28 15:20:56 +03:00
73 lines
2.6 KiB
YAML
73 lines
2.6 KiB
YAML
name: build
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
gotify:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/setup-go@v2
|
|
with:
|
|
go-version: 1.21.x
|
|
- uses: actions/setup-node@v1
|
|
with:
|
|
node-version: '20'
|
|
- 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
|
|
- run: (cd ui && yarn)
|
|
- run: make build-js
|
|
- uses: golangci/golangci-lint-action@v3
|
|
with:
|
|
version: v1.45
|
|
args: --timeout=5m
|
|
skip-cache: true
|
|
- run: go mod download
|
|
- run: make download-tools
|
|
- 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
|
|
echo "$DOCKER_GHCR_PASS" | docker login ghcr.io --username "$DOCKER_GHCR_USER" --password-stdin
|
|
docker push --all-tags gotify/server
|
|
docker push --all-tags gotify/server-arm7
|
|
docker push --all-tags gotify/server-arm64
|
|
docker push --all-tags gotify/server-riscv64
|
|
docker push --all-tags ghcr.io/gotify/server
|
|
docker push --all-tags ghcr.io/gotify/server-arm7
|
|
docker push --all-tags ghcr.io/gotify/server-arm64
|
|
docker push --all-tags ghcr.io/gotify/server-riscv64
|
|
env:
|
|
DOCKER_USER: ${{ secrets.DOCKER_USER }}
|
|
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
|
|
DOCKER_GHCR_USER: ${{ secrets.DOCKER_GHCR_USER }}
|
|
DOCKER_GHCR_PASS: ${{ secrets.DOCKER_GHCR_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
|