packages/.github/workflows/long-built.yml

413 lines
11 KiB
YAML

name: Long Built
on:
push:
branches:
- main
paths:
- 'long-built/**'
workflow_dispatch:
inputs:
packages:
description: "Packege to rebuild"
required: true
jobs:
build-container:
runs-on: ubuntu-latest
container: ghcr.io/built-aur/packages:latest
steps:
- name: work around permission issue
run: git config --global --add safe.directory /__w/packages/packages
- name: Checkout latest commit
uses: actions/checkout@v3
with:
fetch-depth: 1000
- name: Install dependencies
run: pacman -Syu --needed --noconfirm docker
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare Build
run: ./scripts/long-built/prepare.sh
env:
github_event: ${{ github.event_name }}
github_inputs_packages: ${{ github.event.inputs.packages }}
- name: Build container
id: build
run: ./scripts/long-built/build-container.sh
env:
REGISTRY: ghcr.io/${{ github.repository_owner }}
GH_REF: ${{ github.ref }}
- name: Push image
run: docker push "${{ steps.build.outputs.version-tag }}"
outputs:
chromium-version: "${{ steps.build.outputs.chromium-version }}"
image-tag: "${{ steps.build.outputs.version-tag }}"
stage-1:
strategy:
fail-fast: false
matrix:
arch: [x86-64, x86-64-v3]
runs-on: ubuntu-latest
needs: build-container
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create SWAP
run: |
sudo fallocate -l 5G ./swapfile
sudo chmod 0600 ./swapfile
sudo mkswap ./swapfile
sudo swapon ./swapfile
sudo fallocate -l 3G /mnt/swapfile_3g
sudo chmod 0600 /mnt/swapfile_3g
sudo mkswap /mnt/swapfile_3g
sudo swapon /mnt/swapfile_3g
- name: Setup Stage
run: npm run setup --prefix ./scripts/long-built
- name: Run Stage
id: stage
uses: ./scripts/long-built
with:
package: packages-${{ matrix.arch }}
use-registry: true
registry-token: "${{ secrets.GITHUB_TOKEN }}"
image-tag: "${{ join(needs.*.outputs.image-tag) }}"
arch: ${{ matrix.arch }}
outputs:
finished: "${{ steps.stage.outputs.finished }}"
package: "${{ steps.stage.outputs.package }}"
image-tag: "${{ steps.stage.outputs.image-tag }}"
stage-2:
strategy:
fail-fast: false
matrix:
arch: [x86-64, x86-64-v3]
runs-on: ubuntu-latest
needs: stage-1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create SWAP
run: |
sudo fallocate -l 5G ./swapfile
sudo chmod 0600 ./swapfile
sudo mkswap ./swapfile
sudo swapon ./swapfile
sudo fallocate -l 3G /mnt/swapfile_3g
sudo chmod 0600 /mnt/swapfile_3g
sudo mkswap /mnt/swapfile_3g
sudo swapon /mnt/swapfile_3g
- name: Setup Stage
run: npm run setup --prefix ./scripts/long-built
- name: Run Stage
id: stage
uses: ./scripts/long-built
with:
finished: "${{ join(needs.*.outputs.finished) }}"
package: packages-${{ matrix.arch }}
progress-name: stage-1-${{ matrix.arch }}
use-registry: true
registry-token: "${{ secrets.GITHUB_TOKEN }}"
image-tag: "${{ join(needs.*.outputs.image-tag) }}"
arch: ${{ matrix.arch }}
outputs:
finished: "${{ steps.stage.outputs.finished }}"
package: "${{ steps.stage.outputs.package }}"
image-tag: "${{ steps.stage.outputs.image-tag }}"
stage-3:
strategy:
fail-fast: false
matrix:
arch: [x86-64, x86-64-v3]
runs-on: ubuntu-latest
needs: stage-2
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create SWAP
run: |
sudo fallocate -l 5G ./swapfile
sudo chmod 0600 ./swapfile
sudo mkswap ./swapfile
sudo swapon ./swapfile
sudo fallocate -l 3G /mnt/swapfile_3g
sudo chmod 0600 /mnt/swapfile_3g
sudo mkswap /mnt/swapfile_3g
sudo swapon /mnt/swapfile_3g
- name: Setup Stage
run: npm run setup --prefix ./scripts/long-built
- name: Run Stage
id: stage
uses: ./scripts/long-built
with:
finished: "${{ join(needs.*.outputs.finished) }}"
package: packages-${{ matrix.arch }}
progress-name: stage-2-${{ matrix.arch }}
use-registry: true
registry-token: "${{ secrets.GITHUB_TOKEN }}"
image-tag: "${{ join(needs.*.outputs.image-tag) }}"
arch: ${{ matrix.arch }}
outputs:
finished: "${{ steps.stage.outputs.finished }}"
package: "${{ steps.stage.outputs.package }}"
image-tag: "${{ steps.stage.outputs.image-tag }}"
stage-4:
strategy:
fail-fast: false
matrix:
arch: [x86-64, x86-64-v3]
runs-on: ubuntu-latest
needs: stage-3
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create SWAP
run: |
sudo fallocate -l 5G ./swapfile
sudo chmod 0600 ./swapfile
sudo mkswap ./swapfile
sudo swapon ./swapfile
sudo fallocate -l 3G /mnt/swapfile_3g
sudo chmod 0600 /mnt/swapfile_3g
sudo mkswap /mnt/swapfile_3g
sudo swapon /mnt/swapfile_3g
- name: Setup Stage
run: npm run setup --prefix ./scripts/long-built
- name: Run Stage
id: stage
uses: ./scripts/long-built
with:
finished: "${{ join(needs.*.outputs.finished) }}"
package: packages-${{ matrix.arch }}
progress-name: stage-3-${{ matrix.arch }}
use-registry: true
registry-token: "${{ secrets.GITHUB_TOKEN }}"
image-tag: "${{ join(needs.*.outputs.image-tag) }}"
arch: ${{ matrix.arch }}
outputs:
finished: "${{ steps.stage.outputs.finished }}"
package: "${{ steps.stage.outputs.package }}"
image-tag: "${{ steps.stage.outputs.image-tag }}"
stage-5:
strategy:
fail-fast: false
matrix:
arch: [x86-64, x86-64-v3]
runs-on: ubuntu-latest
needs: stage-4
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create SWAP
run: |
sudo fallocate -l 5G ./swapfile
sudo chmod 0600 ./swapfile
sudo mkswap ./swapfile
sudo swapon ./swapfile
sudo fallocate -l 3G /mnt/swapfile_3g
sudo chmod 0600 /mnt/swapfile_3g
sudo mkswap /mnt/swapfile_3g
sudo swapon /mnt/swapfile_3g
- name: Setup Stage
run: npm run setup --prefix ./scripts/long-built
- name: Run Stage
id: stage
uses: ./scripts/long-built
with:
finished: "${{ join(needs.*.outputs.finished) }}"
package: packages-${{ matrix.arch }}
progress-name: stage-4-${{ matrix.arch }}
use-registry: true
registry-token: "${{ secrets.GITHUB_TOKEN }}"
image-tag: "${{ join(needs.*.outputs.image-tag) }}"
arch: ${{ matrix.arch }}
outputs:
finished: "${{ steps.stage.outputs.finished }}"
package: "${{ steps.stage.outputs.package }}"
image-tag: "${{ steps.stage.outputs.image-tag }}"
stage-6:
strategy:
fail-fast: false
matrix:
arch: [x86-64, x86-64-v3]
runs-on: ubuntu-latest
needs: stage-5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create SWAP
run: |
sudo fallocate -l 5G ./swapfile
sudo chmod 0600 ./swapfile
sudo mkswap ./swapfile
sudo swapon ./swapfile
sudo fallocate -l 3G /mnt/swapfile_3g
sudo chmod 0600 /mnt/swapfile_3g
sudo mkswap /mnt/swapfile_3g
sudo swapon /mnt/swapfile_3g
- name: Setup Stage
run: npm run setup --prefix ./scripts/long-built
- name: Run Stage
id: stage
uses: ./scripts/long-built
with:
finished: "${{ join(needs.*.outputs.finished) }}"
package: packages-${{ matrix.arch }}
progress-name: stage-5-${{ matrix.arch }}
use-registry: true
registry-token: "${{ secrets.GITHUB_TOKEN }}"
image-tag: "${{ join(needs.*.outputs.image-tag) }}"
arch: ${{ matrix.arch }}
outputs:
finished: "${{ steps.stage.outputs.finished }}"
package: "${{ steps.stage.outputs.package }}"
image-tag: "${{ steps.stage.outputs.image-tag }}"
stage-7:
strategy:
fail-fast: false
matrix:
arch: [x86-64, x86-64-v3]
runs-on: ubuntu-latest
needs: stage-6
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create SWAP
run: |
sudo fallocate -l 5G ./swapfile
sudo chmod 0600 ./swapfile
sudo mkswap ./swapfile
sudo swapon ./swapfile
sudo fallocate -l 3G /mnt/swapfile_3g
sudo chmod 0600 /mnt/swapfile_3g
sudo mkswap /mnt/swapfile_3g
sudo swapon /mnt/swapfile_3g
- name: Setup Stage
run: npm run setup --prefix ./scripts/long-built
- name: Run Stage
id: stage
uses: ./scripts/long-built
with:
finished: "${{ join(needs.*.outputs.finished) }}"
package: packages-${{ matrix.arch }}
progress-name: stage-6-${{ matrix.arch }}
use-registry: true
registry-token: "${{ secrets.GITHUB_TOKEN }}"
image-tag: "${{ join(needs.*.outputs.image-tag) }}"
arch: ${{ matrix.arch }}
outputs:
finished: "${{ steps.stage.outputs.finished }}"
package: "${{ steps.stage.outputs.package }}"
image-tag: "${{ steps.stage.outputs.image-tag }}"
upload:
if: github.event_name != 'pull_request' && always()
needs: stage-7
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
fetch-depth: 1000
- name: Download artifact
uses: actions/download-artifact@v3
with:
path: ./
- name: Import GPG key
if: always() && github.event_name != 'pull_request'
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_SECRET }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Sign packages
if: always() && github.event_name != 'pull_request'
env:
gpg_key: ${{ secrets.GPG_KEY }}
run: |
for file in ./packages-*/*.pkg.tar*
do
gpg --detach-sign --use-agent --default-key "${gpg_key}" --batch --yes "${file}"
done
- name: Upload packages
if: always() && github.event_name != 'pull_request'
env:
SFTP_HOST: ${{ secrets.SFTP_HOST }}
SFTP_USER: ${{ secrets.SFTP_USER }}
SFTP_PASSWORD: ${{ secrets.SFTP_PASSWORD }}
SFTP_CWD: ${{ secrets.SFTP_CWD }}
run: ./scripts/upload.sh