Skip to content

Commit

Permalink
Merge pull request #449 from openziti/linux-package
Browse files Browse the repository at this point in the history
add linux package
  • Loading branch information
qrkourier authored Aug 29, 2024
2 parents 0fa38fc + 331f617 commit 6dd33ac
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 15 deletions.
23 changes: 11 additions & 12 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
name: Push SPA Image to Docker Hub

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Publish Console Image to Docker Hub

on:
push:
branches: [ "main" ]
tags:
# Publish semver tags as releases.
- 'app-ziti-console-v*.*.*'
- app-ziti-console-v*.*.*

env:
REGISTRY: docker.io
Expand Down Expand Up @@ -54,18 +49,22 @@ jobs:
# set "main" tag on revisions that are accepted into the default branch
type=raw,value=${{ github.ref_name }},enable={{is_default_branch}}
# set "latest" tag on releases
type=raw,value=latest,enable=${{startsWith(github.ref, 'refs/tags/app-ziti-console-v')}}
type=raw,value=latest,enable=${{startsWith(github.ref_name, 'app-ziti-console-v')}}
# set (e.g., "1.2.3") semver tag on releases
type=match,pattern=app-ziti-console-v(.*),group=1,enable=${{startsWith(github.ref, 'refs/tags/app-ziti-console-v')}}
type=match,pattern=app-ziti-console-v(.*),group=1,enable=${{startsWith(github.ref_name, 'app-ziti-console-v')}}
# set (e.g., "v1") major version tag on releases
type=match,pattern=app-ziti-console-(v\d+)\..*,group=1,enable=${{startsWith(github.ref, 'refs/tags/app-ziti-console-v')}}
type=match,pattern=app-ziti-console-(v\d+)\..*,group=1,enable=${{startsWith(github.ref_name, 'app-ziti-console-v')}}
- name: Set Up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: amd64,arm64

- name: Set Up Docker BuildKit
id: buildx
uses: docker/setup-buildx-action@v3

# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build and Push Docker Image
id: push
uses: docker/build-push-action@v5
Expand All @@ -74,7 +73,7 @@ jobs:
file: ./docker-images/ziti-console-assets/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
Expand Down
162 changes: 162 additions & 0 deletions .github/workflows/linux-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
name: Publish Linux Packages

on:
push:
tags:
# Publish semver tags as releases.
- app-ziti-console-v*.*.*

jobs:
parse-version:
name: Find Console Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.parse.outputs.version }}
steps:
- name: Checkout Workspace
uses: actions/checkout@v4

- name: Derive version from tag or package
id: parse
shell: bash
env:
GITHUB_REF_NAME: ${{ github.ref_name }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: |
set -o pipefail
echo "version=${GITHUB_REF_NAME#app-ziti-console-v}" | tee -a $GITHUB_OUTPUT
build-and-upload-app-ziti-console:
needs: parse-version
name: Build Console ZIP
runs-on: ubuntu-latest
env:
BUILD_CONFIG: "Release"
steps:
- name: Checkout Workspace
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://npm.pkg.github.com/

- name: build app-ziti-console
shell: bash
run: ./build.sh /zac/

- name: upload app-ziti-console
uses: actions/upload-artifact@v4
with:
name: app-ziti-console
path: ./dist/app-ziti-console/

publish-linux-packages:
needs:
- parse-version
- build-and-upload-app-ziti-console
name: ${{ matrix.package_name }} ${{ matrix.arch.rpm }} ${{ matrix.nfpm_packager }}
runs-on: ubuntu-latest
strategy:
matrix:
package_name:
- openziti-console
arch:
- goreleaser: amd64
deb: amd64
rpm: x86_64
- goreleaser: arm64
deb: arm64
rpm: aarch64
- goreleaser: armv7
deb: armv7
rpm: armv7
nfpm_packager:
- rpm
- deb
# - archlinux # (pacman)
env:
ZAC_VERSION: ${{ needs.parse-version.outputs.version }}
ZITI_MAINTAINER: "OpenZiti Maintainers <[email protected]>"
ZITI_HOMEPAGE: "https://openziti.io"
ZITI_VENDOR: "NetFoundry, Inc."
GOARCH: ${{ matrix.arch.goreleaser }}
ZITI_DEB_TEST_REPO: ${{ vars.ZITI_DEB_TEST_REPO || 'zitipax-openziti-deb-test' }}
ZITI_RPM_TEST_REPO: ${{ vars.ZITI_RPM_TEST_REPO || 'zitipax-openziti-rpm-test' }}
ZITI_DEB_PROD_REPO: ${{ vars.ZITI_DEB_PROD_REPO || 'zitipax-openziti-deb-stable' }}
ZITI_RPM_PROD_REPO: ${{ vars.ZITI_RPM_PROD_REPO || 'zitipax-openziti-rpm-stable' }}
NFPM_VERSION: "2.38.0"
JFROG_CLI_VERSION: "2.63.0"
steps:
- name: Checkout Workspace
uses: actions/checkout@v4

- name: Download app-ziti-console
uses: actions/download-artifact@v4
with:
name: app-ziti-console
path: ./dist/app-ziti-console

- name: Build Package
id: nfpm
uses: burningalchemist/action-gh-nfpm@eeac96f42da23d091eec0d0088bf05cac0ceb9f3
with:
nfpm_version: ${{ env.NFPM_VERSION }}
packager: ${{ matrix.nfpm_packager }}
config: ./linux-packages/openziti-console/nfpm-${{ matrix.package_name }}.yaml
target: ./dist/

- name: upload package artifact to build summary page
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package_name }}-${{ matrix.arch.goreleaser }}-${{ matrix.nfpm_packager }}
path: ./dist/${{ matrix.package_name }}*.${{ matrix.nfpm_packager }}
if-no-files-found: error

- name: Configure jFrog CLI
uses: jfrog/setup-jfrog-cli@v4
env:
JF_ENV_1: ${{ secrets.ZITI_ARTIFACTORY_CLI_CONFIG_PACKAGE_UPLOAD }}
with:
version: ${{ env.JFROG_CLI_VERSION }}

- name: Upload RPM to Artifactory testing repo
if: matrix.nfpm_packager == 'rpm'
shell: bash
run: >
jf rt upload
./dist/${{ matrix.package_name }}*.rpm
${{ env.ZITI_RPM_TEST_REPO }}/redhat/${{ matrix.arch.rpm }}/
--recursive=false
--flat=true
- name: Upload DEB to Artifactory testing repo
if: matrix.nfpm_packager == 'deb'
shell: bash
run: >
jf rt upload
./dist/${{ matrix.package_name }}*.deb
${{ env.ZITI_DEB_TEST_REPO }}/pool/${{ matrix.package_name }}/${{ matrix.arch.deb }}/
--deb=debian/main/${{ matrix.arch.deb }}
--recursive=false
--flat=true
- name: Copy DEB from test repo to stable repo with jFrog CLI
if: matrix.nfpm_packager == 'deb'
shell: bash
run: >
jf rt copy
--recursive=false
--flat=true
${{ env.ZITI_DEB_TEST_REPO }}/pool/${{ matrix.package_name }}/${{ matrix.arch.deb }}/${{ matrix.package_name }}_${{ needs.parse-version.outputs.version }}_*.deb
${{ env.ZITI_DEB_PROD_REPO }}/pool/${{ matrix.package_name }}/${{ matrix.arch.deb }}/
- name: Copy RPM from test repo to stable repo with jFrog CLI
if: matrix.nfpm_packager == 'rpm'
shell: bash
run: >
jf rt copy
--recursive=false
--flat=true
${{ env.ZITI_RPM_TEST_REPO }}/redhat/${{ matrix.arch.rpm }}/${{ matrix.package_name }}-${{ needs.parse-version.outputs.version }}-*.${{ matrix.arch.rpm }}.rpm
${{ env.ZITI_RPM_PROD_REPO }}/redhat/${{ matrix.arch.rpm }}/
4 changes: 2 additions & 2 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
BUILD_CONFIG: "Release"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
Expand Down
15 changes: 14 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

if ! (( $# ))
then
echo "usage: $0 <base-href>"
exit 1
fi

npm install
npm install -g @angular/[email protected]
ng build ziti-console-lib
ng build ziti-console --base-href $1 --deploy-url $1 --configuration "production"
# WARN: deployUrl deprecated since Angular 13, pending decommission in future ng CLI
ng build ziti-console --base-href "$1" --deploy-url "$1" --configuration "production"
16 changes: 16 additions & 0 deletions linux-packages/openziti-console/nfpm-openziti-console.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# nfpm configuration file
#
# check https://nfpm.goreleaser.com/configuration for detailed usage
#
name: openziti-console
arch: ${GOARCH}
platform: linux
version: ${ZAC_VERSION}
maintainer: ${ZITI_MAINTAINER}
description: A single-page web application for managing an OpenZiti overlay network
vendor: ${ZITI_VENDOR}
homepage: ${ZITI_HOMEPAGE}
license: Apache-2.0
contents:
- dst: /opt/openziti/share/console
src: ./dist/app-ziti-console

0 comments on commit 6dd33ac

Please sign in to comment.