Skip to content

Commit

Permalink
Direct generation of pages
Browse files Browse the repository at this point in the history
  • Loading branch information
jbigot committed Dec 5, 2024
1 parent a94c755 commit c767b38
Show file tree
Hide file tree
Showing 62 changed files with 255 additions and 1,847 deletions.
76 changes: 76 additions & 0 deletions .github/actions/aggregate/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Aggregate step
description: 'Aggregate packages from all distributions'
inputs:
GITHUB_TOKEN:
required: true
description: "GITHUB_TOKEN"
runs:
using: "composite"
steps:
- name: Aggregate sources
id: ident
shell: bash
run: |
for DISTRIB in debian fedora ubuntu pdi-main.debian pdi-main.fedora pdi-main.ubuntu
do
CID="$(docker create ghcr.io/pdidev/pkgs/lastbuild:debian /bin/bash)"
docker cp "${CID}:run_id" "${DISTRIB}.run_id"
echo "${DISTRIB}_run_id=$(cat ${DISTRIB}.run_id)\n" >> $GITHUB_OUTPUT
done
- uses: actions/download-artifact@v4
continue-on-error: true
with:
name: debian
github-token: ${{ inputs.GITHUB_TOKEN }}
run-id: ${{steps.ident.outputs.debian_run_id}}
path: _site/debian
- uses: actions/download-artifact@v4
continue-on-error: true
with:
name: fedora
github-token: ${{ inputs.GITHUB_TOKEN }}
run-id: ${{steps.ident.outputs.fedora_run_id}}
path: _site/fedora
- uses: actions/download-artifact@v4
continue-on-error: true
with:
name: ubuntu
github-token: ${{ inputs.GITHUB_TOKEN }}
run-id: ${{steps.ident.outputs.ubuntu_run_id}}
path: _site/ubuntu
- uses: actions/download-artifact@v4
continue-on-error: true
with:
name: pdi-main.debian
github-token: ${{ inputs.GITHUB_TOKEN }}
run-id: ${{steps.ident.outputs.debian_run_id}}
path: _site/pdi-main.debian
- uses: actions/download-artifact@v4
continue-on-error: true
with:
name: pdi-main.fedora
github-token: ${{ inputs.GITHUB_TOKEN }}
run-id: ${{steps.ident.outputs.fedora_run_id}}
path: _site/pdi-main.fedora
- uses: actions/download-artifact@v4
continue-on-error: true
with:
name: pdi-main.ubuntu
github-token: ${{ inputs.GITHUB_TOKEN }}
run-id: ${{steps.ident.outputs.ubuntu_run_id}}
path: _site/pdi-main.ubuntu
- name: Link to pdi-master
shell: bash
run: |
set -x
ls -R
cd _site
for DISTRIB in debian fedora ubuntu
do
if [ -d "pdi-main.${DISTRIB}" ]
then ln -s "pdi-master.${DISTRIB}" "pdi-main.${DISTRIB}"
fi
done
ls -R
- name: Upload page artifact
uses: actions/upload-pages-artifact@v3
57 changes: 57 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build step
description: 'Build pages for a given distribution'
inputs:
GITHUB_TOKEN:
required: true
description: "GITHUB_TOKEN"
KEY_PASSPHRASE:
required: true
description: "KEY_PASSPHRASE"
distribution:
required: true
description: "name of the distribution"
runs:
using: "composite"
steps:
- uses: docker/login-action@v3
with: { registry: "ghcr.io", username: "${{ github.actor }}", password: "${{ inputs.GITHUB_TOKEN }}" }
- name: Checkout builder script
uses: actions/checkout@v4
with:
repository: jbigot/pkg_builder
path: pkg_builder
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install deps
shell: bash
run: |
#echo ${{ inputs.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
#curl -o - https://www.aptly.info/pubkey.txt | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/aptly.gpg > /dev/null
#echo "deb http://repo.aptly.info/ squeeze main" | sudo tee /etc/apt/sources.list.d/aptly.list
#sudo apt-get update
#sudo apt-get upgrade
#sudo apt-get install devscripts equivs aptly
#pip3.8 install -r pkg_builder/requirements.txt
- name: Build packages
env:
KEY_PASSPHRASE: ${{ inputs.KEY_PASSPHRASE }}
DISTRIB: ${{ inputs.distribution }}
shell: bash
run: |
#python3.8 pkg_builder/pkgbuild -D ${DISTRIB} -j 3 -p "${KEY_PASSPHRASE}"
mkdir ${DISTRIB}
echo "test ${DISTRIB} at $(date)" > ${DISTRIB}/index.html
- name: Upload artifact
uses: actions/upload-artifact@v4
id: artifact
with:
name: ${{ inputs.distribution }}
path: ./${{ inputs.distribution }}
- name: Make artifact descriptor container
shell: bash
run: |
echo "${{ github.run_id }}" > run_id
tar -c run_id | docker import - ghcr.io/pdidev/pkgs/lastbuild:${{ inputs.distribution }}
docker push ghcr.io/pdidev/pkgs/lastbuild:${{ inputs.distribution }}
58 changes: 58 additions & 0 deletions .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: 'build & deploy'
on:
pull_request:
push:
branches: [ stable, pdi-main ]
schedule:
- cron: '27 1 3 * *' # monthly build on 1st of each month, 1:27AM => stable
- cron: '27 2 * * *' # daily build at 2:27AM => pdi-main
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
distrib: [ debian, fedora, ubuntu ]
steps:
- if: "github.event_name != 'schedule' || github.event.schedule != '27 2 * * *'"
name: Checkout packages
uses: actions/checkout@v4
- if: github.event.schedule == '27 2 * * *'
name: Checkout packages
uses: actions/checkout@v4
ref: pdi-main
- uses: pdidev/pkgs/.github/actions/build@stable
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
KEY_PASSPHRASE: "${{ secrets.KEY_PASSPHRASE }}"
distribution: "${{ matrix.distrib }}"
aggregate:
if: ${{ always() && github.event_name != 'pull_request' }}
needs: build
runs-on: ubuntu-20.04
steps:
- name: Checkout packages
uses: actions/checkout@v4
with: { path: data }
- name: Aggregate sources
run: |
mkdir _site
cp data/README.tpl/index.html _site
rm -rf data
- uses: pdidev/pkgs/.github/actions/aggregate@stable
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
publish:
needs: aggregate
if: "github.event_name != 'pull_request'"
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
58 changes: 0 additions & 58 deletions .github/workflows/pdi-main.yml

This file was deleted.

57 changes: 0 additions & 57 deletions .github/workflows/pull.yml

This file was deleted.

57 changes: 0 additions & 57 deletions .github/workflows/stable.yml

This file was deleted.

Loading

0 comments on commit c767b38

Please sign in to comment.