2021-04-17 04:02:33 +08:00
|
|
|
name: Build and Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
version:
|
|
|
|
description: 'Netmaker version'
|
2022-03-10 23:10:32 +08:00
|
|
|
required: true
|
2021-04-17 04:02:33 +08:00
|
|
|
release:
|
2022-01-07 04:32:19 +08:00
|
|
|
types: [published]
|
2021-04-17 04:02:33 +08:00
|
|
|
|
|
|
|
jobs:
|
2022-03-11 23:03:29 +08:00
|
|
|
version:
|
2021-04-17 04:02:33 +08:00
|
|
|
runs-on: ubuntu-latest
|
2022-03-11 22:08:41 +08:00
|
|
|
outputs:
|
2023-02-16 04:29:42 +08:00
|
|
|
tag: ${{ steps.version.outputs.package_version }}
|
2023-02-15 22:29:28 +08:00
|
|
|
version: ${{ steps.version.outputs.version }}
|
2021-04-17 04:02:33 +08:00
|
|
|
steps:
|
2022-03-09 22:05:49 +08:00
|
|
|
- name: Get Version Number
|
2023-02-15 22:29:28 +08:00
|
|
|
id: version
|
2022-03-09 22:05:49 +08:00
|
|
|
run: |
|
2022-03-12 06:41:46 +08:00
|
|
|
if [[ -n "${{ github.event.inputs.version }}" ]]; then
|
2021-04-17 04:02:33 +08:00
|
|
|
NETMAKER_VERSION=${{ github.event.inputs.version }}
|
|
|
|
else
|
|
|
|
NETMAKER_VERSION=$(curl -fsSL https://api.github.com/repos/gravitl/netmaker/tags | grep 'name' | head -1 | cut -d'"' -f4)
|
|
|
|
fi
|
2023-02-16 04:29:42 +08:00
|
|
|
echo "VERSION=${NETMAKER_VERSION}" >> $GITHUB_OUTPUT
|
2022-03-10 22:32:43 +08:00
|
|
|
# remove everything but digits and . for package (deb, rpm, etc) versions
|
2022-03-10 22:52:47 +08:00
|
|
|
PACKAGE_VERSION=$(echo ${NETMAKER_VERSION} | tr -cd '[:digit:].')
|
2023-02-15 22:29:28 +08:00
|
|
|
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT
|
|
|
|
netmaker-nmctl:
|
2022-03-11 22:08:41 +08:00
|
|
|
runs-on: ubuntu-latest
|
2022-03-11 23:03:29 +08:00
|
|
|
needs: version
|
2022-03-11 22:08:41 +08:00
|
|
|
steps:
|
2022-03-11 23:03:29 +08:00
|
|
|
- name: Checkout
|
2022-11-10 23:52:44 +08:00
|
|
|
uses: actions/checkout@v3
|
2023-02-16 04:29:42 +08:00
|
|
|
with:
|
|
|
|
ref: release_${{ needs.version.outputs.version }}
|
|
|
|
fetch-depth: 0
|
|
|
|
- run: git fetch --force --tags
|
2022-03-11 22:08:41 +08:00
|
|
|
- name: Setup go
|
2022-12-06 23:52:37 +08:00
|
|
|
uses: actions/setup-go@v3
|
2022-03-11 22:08:41 +08:00
|
|
|
with:
|
2022-11-11 05:06:03 +08:00
|
|
|
go-version: 1.19
|
2023-02-15 22:29:28 +08:00
|
|
|
- name: GoReleaser
|
2023-02-16 04:29:42 +08:00
|
|
|
uses: goreleaser/goreleaser-action@v4
|
2022-03-11 22:25:55 +08:00
|
|
|
with:
|
2023-02-15 22:29:28 +08:00
|
|
|
args: release --clean
|
2023-02-16 04:29:42 +08:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|