Skip to content

Build, test, and release #64

Build, test, and release

Build, test, and release #64

# SPDX-FileCopyrightText: 2022 Sascha Brawer <sascha@brawer.ch>
# SPDX-Licence-Identifier: MIT
name: Build, test, and release
on: [push, pull_request]
jobs:
build-test-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out source code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Build
run: |
go build -o artifacts/builder -ldflags="-s -w -X main.SoftwareVersion=OSMViews/${{github.ref_name}}" -v ./cmd/osmviews-builder
go build -o artifacts/webserver -ldflags="-s -w -X main.ServerVersion=OSMViews/${{github.ref_name}}" -v ./cmd/webserver
- name: Test
run: go test -v ./...
- name: Release
if: startsWith(github.ref, 'refs/tags')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: hub release create -m ${{github.ref_name}} -a artifacts/builder -a artifacts/webserver ${{github.ref_name}}