mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 10:42:23 +00:00
135 lines
4.5 KiB
YAML
135 lines
4.5 KiB
YAML
name: Nightly
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "10 9,21 * * *"
|
|
workflow_dispatch:
|
|
|
|
permissions: {}
|
|
|
|
cache-mode: none
|
|
|
|
concurrency:
|
|
group: nightly
|
|
cancel-in-progress: false
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
plan:
|
|
name: Plan nightly
|
|
if: ${{ github.repository == 'coollabsio/coolify' }}
|
|
permissions:
|
|
contents: read
|
|
runs-on: ubuntu-26.04 # https://github.com/actions/runner-images
|
|
timeout-minutes: 10
|
|
outputs:
|
|
nightly: ${{ steps.plan.outputs.nightly }}
|
|
steps:
|
|
- name: Check out next
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # https://github.com/actions/checkout/releases/tag/v7.0.1
|
|
with:
|
|
ref: next
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Plan the nightly
|
|
id: plan
|
|
env:
|
|
BRANCH: next
|
|
run: |
|
|
labels="$(docker buildx imagetools inspect ghcr.io/coollabsio/coolify:nightly --format '{{ json (index .Image "linux/amd64").Config.Labels }}')" || labels='{}'
|
|
NIGHTLY_VERSION="$(jq -r '.["org.opencontainers.image.version"] // empty' <<< "$labels")"
|
|
NIGHTLY_REVISION="$(jq -r '.["org.opencontainers.image.revision"] // empty' <<< "$labels")"
|
|
export NIGHTLY_VERSION NIGHTLY_REVISION
|
|
nightly="$(scripts/plan-version.sh --nightly)"
|
|
echo "nightly=$nightly" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
build:
|
|
name: Build
|
|
needs: plan
|
|
if: ${{ needs.plan.outputs.nightly != '' }}
|
|
permissions:
|
|
contents: read
|
|
uses: $/.github/workflows/build.yaml
|
|
with:
|
|
ref: ${{ fromJSON(needs.plan.outputs.nightly).revision }}
|
|
coolify: ${{ fromJSON(needs.plan.outputs.nightly).image }}
|
|
|
|
publish:
|
|
name: Publish nightly (${{ matrix.line.tag }})
|
|
needs: [plan, build]
|
|
permissions:
|
|
packages: write # push the built nightly to ghcr.io and move the nightly tag
|
|
environment:
|
|
name: release
|
|
deployment: false
|
|
runs-on: ubuntu-26.04 # https://github.com/actions/runner-images
|
|
timeout-minutes: 30
|
|
strategy:
|
|
matrix:
|
|
line: ${{ fromJSON(needs.plan.outputs.nightly).lines }}
|
|
steps:
|
|
- name: Download the built images
|
|
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # https://github.com/actions/download-artifact/releases/tag/v8.0.2
|
|
with:
|
|
pattern: image-*
|
|
path: ${{ runner.temp }}/images
|
|
|
|
- name: Log in to ghcr.io
|
|
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # https://github.com/docker/login-action/releases/tag/v4.7.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Log in to docker.io
|
|
uses: docker/login-action@81c6f93d4bc991e510b342a00b419b3bb4efc5c6 # https://github.com/docker/login-action/releases/tag/v4.7.0
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Push the built nightly
|
|
env:
|
|
TAG: ${{ matrix.line.tag }}
|
|
LINE: ${{ matrix.line.name }}
|
|
run: |
|
|
sources=()
|
|
for index in "$RUNNER_TEMP"/images/*/index.json; do
|
|
sources+=("oci-layout://${index%/index.json}@$(jq -r '.manifests[0].digest' "$index")")
|
|
done
|
|
for repository in ghcr.io/coollabsio/coolify docker.io/coollabsio/coolify; do
|
|
tags=(--tag "$repository:${TAG#v}")
|
|
[ "$LINE" != latest ] || tags+=(--tag "$repository:nightly")
|
|
docker buildx imagetools create "${tags[@]}" "${sources[@]}"
|
|
done
|
|
|
|
cdn:
|
|
name: Sync CDN
|
|
needs: [plan, publish]
|
|
permissions:
|
|
contents: read
|
|
environment:
|
|
name: release
|
|
deployment: false
|
|
runs-on: ubuntu-26.04 # https://github.com/actions/runner-images
|
|
timeout-minutes: 10
|
|
steps:
|
|
- name: Check out the nightly
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # https://github.com/actions/checkout/releases/tag/v7.0.1
|
|
with:
|
|
ref: ${{ fromJSON(needs.plan.outputs.nightly).revision }}
|
|
persist-credentials: false
|
|
|
|
- name: Sync the nightly channel of the CDN
|
|
env:
|
|
GH_TOKEN: ${{ secrets.CDN_TOKEN }}
|
|
IMAGE_VERSION: ${{ fromJSON(needs.plan.outputs.nightly).image }}
|
|
run: |
|
|
gh auth setup-git
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
scripts/sync-cdn.sh --nightly "$IMAGE_VERSION"
|