Skip to content

Commit

Permalink
feat: initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
pcfreak30 committed Dec 13, 2024
1 parent 56b75da commit 3332a81
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 1 deletion.
84 changes: 84 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
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

- id: set-matrix
run: |
GROUPS=$(yq eval -o=json groups.yaml)
if [[ -n "${{ github.event.inputs.specific_group }}" ]]; then
GROUPS=$(echo "$GROUPS" | jq ".groups | {\"${{ github.event.inputs.specific_group }}\": .\"${{ github.event.inputs.specific_group }}\"}")
else
GROUPS=$(echo "$GROUPS" | jq ".groups")
fi
echo "matrix=$(echo "$GROUPS" | jq -c .)" >> $GITHUB_OUTPUT
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
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM alpine:latest
COPY portal /usr/local/bin/portal
ENTRYPOINT ["/usr/local/bin/portal"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 Lume Web
Copyright (c) 2024 Hammer Technologies LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 10 additions & 0 deletions groups.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
groups:
core:
plugins:
base:
plugins:
- go.lumeweb.com/portal-plugin-dashboard@latest
standard:
plugins:
- go.lumeweb.com/portal-plugin-dashboard@latest
- go.lumeweb.com/portal-plugin-ipfs@latest

0 comments on commit 3332a81

Please sign in to comment.