mirror of
https://github.com/gotify/server.git
synced 2026-09-06 15:57:32 +08:00
73 lines
2.8 KiB
YAML
73 lines
2.8 KiB
YAML
name: build
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
gotify:
|
|
runs-on: ubuntu-latest
|
|
# Run on push for branches in this repo, and on pull_request only for forks.
|
|
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.repository != github.event.pull_request.head.repo.full_name)
|
|
steps:
|
|
- uses: actions/setup-go@v7
|
|
with:
|
|
go-version: 1.26.x
|
|
- uses: actions/setup-node@v7
|
|
with:
|
|
node-version: '24'
|
|
- uses: actions/checkout@v7
|
|
- run: (cd ui && yarn)
|
|
- run: make build-js
|
|
- uses: golangci/golangci-lint-action@v9
|
|
with:
|
|
version: v2.12.2
|
|
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@v7
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
- 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"
|
|
echo "LD_FLAGS=$LD_FLAGS" >> $GITHUB_ENV
|
|
|
|
make build
|
|
sudo chown -R $UID build
|
|
make package-zip
|
|
ls -lath build
|
|
- if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/master')
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
- if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/master')
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v4
|
|
- if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/master')
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ secrets.DOCKER_USER }}
|
|
password: ${{ secrets.DOCKER_PASS }}
|
|
- if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/master')
|
|
uses: docker/login-action@v4
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ secrets.DOCKER_GHCR_USER }}
|
|
password: ${{ secrets.DOCKER_GHCR_PASS }}
|
|
- if: startsWith(github.ref, 'refs/tags/v')
|
|
run: |
|
|
make DOCKER_BUILD_PUSH=true build-docker
|
|
- if: startsWith(github.ref, 'refs/heads/master')
|
|
run: |
|
|
make DOCKER_BUILD_PUSH=true build-docker-multiarch-master
|
|
- 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
|