-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |