Skip to content

feat: initial version #2

feat: initial version

feat: initial version #2

Workflow file for this run

name: Build Portal Images
on:
push:
branches: ['develop']
workflow_dispatch:
inputs:
specific_group:
description: 'Build specific group (empty for all)'
required: false
type: string
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: mikefarah/yq@v4
id: set-matrix
with:
cmd: eval -o=json .groups plugin-groups.yaml
- if: inputs.specific_group != ''
uses: mikefarah/yq@master
id: set-matrix-filtered
with:
cmd: |
eval -o=json ".groups | { \"${{ inputs.specific_group }}\": .\"${{ inputs.specific_group }}\" }" plugin-groups.yaml
- name: Set final matrix
id: set-final-matrix
run: |
if [[ -n "${{ inputs.specific_group }}" ]]; then
echo "matrix=${{ steps.set-matrix-filtered.outputs.result }}" >> $GITHUB_OUTPUT
else
echo "matrix=${{ steps.set-matrix.outputs.result }}" >> $GITHUB_OUTPUT
fi
build:
needs: prepare
runs-on: ubuntu-latest
strategy:
matrix:
include: ${{ fromJSON(needs.prepare.outputs.matrix) }}
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: true
# Cache xportal binary install
- name: Cache xportal
id: cache-xportal
uses: actions/cache@v3
with:
path: ~/go/bin/xportal
key: ${{ runner.os }}-xportal-${{ hashFiles('go.mod', 'go.sum') }}
# Install xportal if not cached
- if: steps.cache-xportal.outputs.cache-hit != 'true'
name: Install xportal
run: go install go.lumeweb.com/xportal/cmd/xportal@latest
# Build portal with plugins and cache dependencies
- name: Build portal
run: |
PLUGINS=$(echo '${{ toJSON(matrix.plugins) }}' | jq -r 'join(" --with ")')
xportal build --with $PLUGINS
- uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
context: .
tags: |
ghcr.io/${{ github.repository }}:${{ matrix.group }}
cache-from: type=gha
cache-to: type=gha,mode=max