Skip to content

Build Portal Images #59

Build Portal Images

Build Portal Images #59

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
- name: Install yq
run: |
LATEST_TAG=$(gh release list --repo mikefarah/yq --limit 1 | cut -f3)
gh release download $LATEST_TAG --repo mikefarah/yq --pattern 'yq_linux_amd64' --output /usr/local/bin/yq
chmod +x /usr/local/bin/yq
env:
GH_TOKEN: ${{ github.token }}
- name: Get matrix
id: set-matrix
run: |
FILTER='to_entries | map(select(.value.plugins != null)) | map({group: .key, plugins: .value.plugins, version: (.value.version // "latest")})'
if [ "${{ inputs.specific_group }}" != "" ]; then
FILTER="$FILTER | map(select(.group == \"${{ inputs.specific_group }}\"))"
fi
echo "matrix=$(yq -o=j '.groups' groups.yaml | jq -c "{include: ($FILTER)}" | jq -c .include)" >> $GITHUB_OUTPUT
build:
needs: prepare
runs-on: ubuntu-latest
timeout-minutes: 30
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.22'
cache: true
# - name: Cache xportal
# id: cache-xportal
# uses: actions/cache@v3
# with:
# path: ~/go/bin/xportal
# key: ${{ runner.os }}-xportal-${{ hashFiles('go.mod', 'go.sum') }}
-
# if: steps.cache-xportal.outputs.cache-hit != 'true'
name: Install xportal
run: GOSUMDB=off GOPROXY=direct go install go.lumeweb.com/xportal/cmd/[email protected]
- name: Build portal
run: |
PLUGINS=$(echo '${{ toJSON(matrix.plugins) }}' | jq -r 'join(" --with ")')
GOPROXY=direct PORTAL_VERSION="${{ matrix.version }}" 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: Set lowercase names
id: names
run: |
echo "repo=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
echo "group=${MATRIX_GROUP,,}" >> $GITHUB_OUTPUT
env:
MATRIX_GROUP: ${{ matrix.group }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
push: true
context: .
tags: |
ghcr.io/${{ steps.names.outputs.repo }}:${{ steps.names.outputs.group }}
cache-from: type=gha
cache-to: type=gha,mode=max