69 lines
2.1 KiB
YAML
69 lines
2.1 KiB
YAML
name: Build JetKVM Cloud docker container
|
|
env:
|
|
UPSTREAM_DIR: ./upstream
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "upstream.conf"
|
|
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ${{ github.workspace }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Setup docker
|
|
uses: https://git.claeyscloud.com/david/gitea-actions/setup-docker@main
|
|
- name: Login to Gitea container registry
|
|
uses: https://github.com/docker/login-action@v3
|
|
with:
|
|
registry: git.claeyscloud.com
|
|
username: nologin
|
|
password: ${{ secrets.PACKAGE_TOKEN }}
|
|
- name: Load upstream configuration
|
|
shell: bash
|
|
run: |
|
|
source upstream.conf
|
|
|
|
echo "BRANCH=$BRANCH" >> "$GITHUB_ENV"
|
|
echo "COMMIT=$COMMIT" >> "$GITHUB_ENV"
|
|
echo "SHORT_COMMIT=${COMMIT:0:7}" >> "$GITHUB_ENV"
|
|
- name: Retrieve code
|
|
shell: bash
|
|
run: |
|
|
echo "Retrieving JetKVM cloud-api"
|
|
echo "Branch: $BRANCH"
|
|
echo "Commit: $COMMIT"
|
|
echo "Destination: $UPSTREAM_DIR"
|
|
|
|
git clone --branch "$BRANCH" https://github.com/jetkvm/cloud-api.git "$UPSTREAM_DIR"
|
|
cd "$UPSTREAM_DIR"
|
|
git checkout "$COMMIT"
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
labels: |
|
|
org.opencontainers.image.documentation=https://git.claeyscloud.com/david/jetkvm-cloud/README.md
|
|
images: |
|
|
git.claeyscloud.com/david/jetkvm-cloud
|
|
tags: |
|
|
type=raw,value=${{ env.BRANCH }}
|
|
type=raw,value=${{ env.SHORT_COMMIT }}
|
|
type=raw,value=latest
|
|
- name: Build and push
|
|
uses: https://github.com/docker/build-push-action@v5
|
|
context: ${{ env.UPSTREAM_DIR }}
|
|
file: ${{ env.UPSTREAM_DIR }}/Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|