Skip to content

Add network name to metadata #82

Add network name to metadata

Add network name to metadata #82

Workflow file for this run

# Copyright 2022 Stichting ThingsIX Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: Router
on:
pull_request:
branches:
- main
push:
tags:
- v*
jobs:
test-build-amd64:
if: startsWith(github.ref, 'refs/tags/') == false
name: Test Build for AMD64
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.5
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: cd ./cmd/router && CGO_ENABLED=0 go build -ldflags "-w -s -X github.com/ThingsIXFoundation/packet-handling/utils.commit=${{github.sha}}" .
release-build:
if: startsWith(github.ref, 'refs/tags/')
name: Build for all archs
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux]
goarch: [amd64, arm64]
include:
- goos: darwin
goarch: amd64
- goos: darwin
goarch: arm64
- goos: windows
goarch: amd64
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.5
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build
run: |
cd ./cmd/router
CGO_ENABLED=0 GOOS=${{matrix.goos}} GOARCH=${{matrix.goarch}} GOMIPS="${{matrix.gomips}}" go build -ldflags "-w -s -X github.com/ThingsIXFoundation/packet-handling/utils.version=${{github.ref_name}} -X github.com/ThingsIXFoundation/packet-handling/utils.commit=${{github.sha}}" .
tar -zcvf thingsix-router-${{matrix.goos}}-${{matrix.goarch}}${{matrix.gomips}}-${{github.ref_name}}.tar.gz router*
- uses: actions/upload-artifact@v3
with:
name: thingsix-router-${{matrix.goos}}-${{matrix.goarch}}${{matrix.gomips}}-${{github.ref_name}}
path: ./cmd/router/*.tar.gz
if-no-files-found: error
release-package-all:
if: startsWith(github.ref, 'refs/tags/')
name: Package all binaries together
runs-on: ubuntu-latest
needs: [release-build]
steps:
- name: Download all binaries
uses: actions/download-artifact@v3
- run: mv **/*.tar.gz .
- name: Upload binaries together
uses: actions/upload-artifact@v3
with:
name: thingsix-router-${{github.ref_name}}
path: '*.tar.gz'