Skip to content

build

build #1069

Workflow file for this run

name: build
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
packages-matrix: ${{ steps.packages-matrix.outputs.JSON_CONTENT }}
repos-matrix: ${{ steps.repos-matrix.outputs.JSON_CONTENT }}
images-matrix: ${{ steps.images-matrix.outputs.JSON_CONTENT }}
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
continue-on-error: true
with:
python-version: '3.11'
cache: 'pip'
- run: pip install -r requirements.txt
- name: Get image list
id: images-matrix
run: |
echo 'JSON_CONTENT<<EOF' >> $GITHUB_OUTPUT
python ./scripts/build.py --repos-dir repos images --json >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Get package list
id: packages-matrix
run: |
echo 'JSON_CONTENT<<EOF' >> $GITHUB_OUTPUT
python ./scripts/build.py --repos-dir repos info --json >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Get repo list
id: repos-matrix
run: |
echo 'JSON_CONTENT<<EOF' >> $GITHUB_OUTPUT
python ./scripts/build.py --repos-dir repos stats --json >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
images:
name: Image ${{ matrix.image }}
runs-on: ubuntu-latest
continue-on-error: true
needs: [setup]
strategy:
matrix: ${{ fromJson(needs.setup.outputs.images-matrix) }}
fail-fast: false
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: registry.eeems.codes
username: github
password: ${{ secrets.CR_PAT }}
- uses: actions/setup-python@v5
continue-on-error: true
with:
python-version: '3.11'
cache: 'pip'
- run: pip install -r requirements.txt
- uses: jpribyl/[email protected]
if: ${{ matrix.runner != 'self-hosted' }}
continue-on-error: true
with:
key: image-${{ matrix.image }}-{hash}
restore-keys: |
image-${{ matrix.image }}-
- name: Image ${{ matrix.image }}
run: |
python -u ./scripts/build.py --repos-dir repos pull ${{ matrix.image }}
env:
GITHUB_ACTIONS: 1
VERBOSE: 1
packages:
name: Package ${{ matrix.repo }}/${{ matrix.package }}
runs-on: ${{ matrix.runner }}
continue-on-error: true
needs: [setup, images]
strategy:
matrix: ${{ fromJson(needs.setup.outputs.packages-matrix) }}
fail-fast: false
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: registry.eeems.codes
username: github
password: ${{ secrets.CR_PAT }}
- uses: actions/setup-python@v5
continue-on-error: true
with:
python-version: '3.11'
cache: 'pip'
- run: pip install -r requirements.txt
- name: Pacman cache
uses: actions/cache@v3
with:
path: cache
key: ${{ runner.os }}
- uses: jpribyl/[email protected]
if: ${{ matrix.runner != 'self-hosted' }}
continue-on-error: true
with:
key: image-${{ matrix.image }}-{hash}
restore-keys: |
image-${{ matrix.image }}-
- name: Download artifact
uses: actions/download-artifact@v3
continue-on-error: true
with:
name: ${{ matrix.repo }}
path: repo
- name: Build ${{ matrix.repo }}/${{ matrix.package }}
timeout-minutes: 720
run: |
python -u ./scripts/build.py --repos-dir repos build package ${{ matrix.package }}
env:
GPGKEY: ${{ secrets.GPGKEY }}
GPG_PRIVKEY: ${{ secrets.GPG_PRIVKEY }}
WORKDIR: workdir
DOCKER_PRUNE: 1
GITHUB_ACTIONS: 1
VERBOSE: 1
- name: Sanitize filename
run: |
cd packages
ls | while read file;do
if [[ "$file" == *:* ]];then
sudo mv "$file" "${file/:/_}"
fi
done
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.repo }}
path: packages
if-no-files-found: error
repos:
name: Repo ${{ matrix.repo }}
runs-on: ubuntu-latest
if: success() || failure()
needs: [setup, images, packages]
strategy:
matrix: ${{ fromJson(needs.setup.outputs.repos-matrix) }}
fail-fast: false
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: registry.eeems.codes
username: github
password: ${{ secrets.CR_PAT }}
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: ${{ matrix.repo }}
path: repo
- uses: actions/setup-python@v5
continue-on-error: true
with:
python-version: '3.11'
cache: 'pip'
- run: pip install -r requirements.txt
- uses: jpribyl/[email protected]
if: ${{ matrix.runner != 'self-hosted' }}
continue-on-error: true
with:
key: image-${{ matrix.image }}-{hash}
restore-keys: |
image-${{ matrix.image }}-
- name: Repo ${{ matrix.repo }}
run: |
python -u ./scripts/build.py --repos-dir repos publish ${{ matrix.repo }}
env:
GPGKEY: ${{ secrets.GPGKEY }}
GPG_PRIVKEY: ${{ secrets.GPG_PRIVKEY }}
REPO_NAME: ${{ matrix.repo }}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.repo }}
path: repo
if-no-files-found: error
mirror0:
name: Mirror0
runs-on: self-hosted
if: success() || failure()
needs: [repos]
environment: repo.eeems.codes
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- uses: ./.github/actions/mirror
with:
server: ${{ vars.SSH_SERVER }}
user: ${{ vars.SSH_USER }}
path: ${{ vars.SSH_PATH }}
key: ${{ secrets.SSH_KEY }}
pat: ${{ secrets.CR_PAT }}
cache: false
mirror1:
name: Mirror1
runs-on: ubuntu-latest
if: success() || failure()
needs: [repos]
environment: repo.eeems.website
steps:
- name: Checkout the Git repository
uses: actions/checkout@v4
- uses: ./.github/actions/mirror
with:
server: ${{ vars.SSH_SERVER }}
user: ${{ vars.SSH_USER }}
path: ${{ vars.SSH_PATH }}
key: ${{ secrets.SSH_KEY }}
pat: ${{ secrets.CR_PAT }}