Test supports remote
This commit is contained in:
@@ -33,12 +33,42 @@ inputs:
|
||||
github_token:
|
||||
description: 'GitHub token for metadata extraction'
|
||||
required: true
|
||||
repository_checkout:
|
||||
description: 'Repository to checkout (if different from the current one)'
|
||||
required: false
|
||||
default: ''
|
||||
ref_checkout:
|
||||
description: 'Git ref (branch/tag/SHA) to checkout in the external repo'
|
||||
required: false
|
||||
default: ''
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
- name: Checkout external repository
|
||||
if: ${{ inputs.repository_checkout != '' }}
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: ${{ inputs.repository_checkout }}
|
||||
ref: ${{ inputs.ref_checkout != '' && inputs.ref_checkout || 'main' }}
|
||||
server-url: ${{ github.server_url }}
|
||||
path: external-src
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checkout repository
|
||||
if: ${{ inputs.repository_checkout == '' }}
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set build context path if remote specified else local
|
||||
id: set-context
|
||||
run: |
|
||||
if [ "${{ inputs.repository_checkout }}" != "" ]; then
|
||||
echo "context_path=external-src" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "context_path=${{ inputs.context_path }}" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Define branch helpers
|
||||
id: branch
|
||||
@@ -79,7 +109,7 @@ runs:
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ${{ inputs.context_path }}
|
||||
context: ${{ steps.set-context.outputs.context_path }}
|
||||
file: ${{ inputs.dockerfile_path }}
|
||||
push: true
|
||||
platforms: ${{ inputs.platforms }}
|
||||
|
||||
71
workflows/upstream-docker-build-push/workflow.yml
Normal file
71
workflows/upstream-docker-build-push/workflow.yml
Normal file
@@ -0,0 +1,71 @@
|
||||
name: Build and Push Docker Image from External Repo
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 2 * * 0" # build periodically
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
external_ref:
|
||||
description: "Git ref (branch/tag/SHA) to build from in the external repo"
|
||||
required: false
|
||||
default: "master"
|
||||
|
||||
env:
|
||||
EXTERNAL_REPO: "Wavyzz/cf-bypass-fast" # owner/name of the other repo (in the same Gitea)
|
||||
DEFAULT_EXTERNAL_REF: "master" # default branch/tag/SHA to build
|
||||
IMAGE_NAME: "cf-bypass-fast" # final image name (tag appended later)
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout this repo (for context & scripts, optional)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checkout external repository to ./external-src
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ${{ env.EXTERNAL_REPO }}
|
||||
ref: ${{ github.event.inputs.external_ref || env.DEFAULT_EXTERNAL_REF }}
|
||||
server-url: ${{ github.server_url }}
|
||||
path: external-src
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Decide image tag
|
||||
id: tag
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ -n "${{ github.event.inputs.image_tag }}" ]]; then
|
||||
TAG="${{ github.event.inputs.image_tag }}"
|
||||
else
|
||||
TAG="latest"
|
||||
fi
|
||||
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Set up Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ secrets.DOCKER_REGISTRY_HOST }}
|
||||
username: ${{ secrets.DOCKER_REGISTRY_USER }}
|
||||
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
# Point to the external checkout dir
|
||||
context: ./external-src
|
||||
# If the Dockerfile isn't named 'Dockerfile' or isn't at repo root, set it explicitly:
|
||||
# file: ./external-src/path/to/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKER_REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
||||
${{ secrets.DOCKER_REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:${{ steps.tag.outputs.tag }}
|
||||
Reference in New Issue
Block a user