Skip to content

run_build

run_build #583

Workflow file for this run

name: Packages
on:
push:
pull_request:
repository_dispatch:
types: [run_build]
jobs:
prepare_jobs:
runs-on: ubuntu-latest
container: node:lts
steps:
- uses: actions/checkout@v3
- name: Install dependencies
id: set-matrix
run: |
echo "dependant=$(node create-matrix.js dependant)" >> $GITHUB_OUTPUT
echo "non_dependant=$(node create-matrix.js non_dependant)" >> $GITHUB_OUTPUT
outputs:
dependant: ${{ steps.set-matrix.outputs.dependant }}
non_dependant: ${{ steps.set-matrix.outputs.non_dependant }}
build:
needs: [prepare_jobs]
runs-on: ubuntu-latest
container: ghcr.io/pspdev/pspsdk:latest
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.prepare_jobs.outputs.non_dependant) }}
steps:
- uses: actions/checkout@v3
- name: Build package
run: |
adduser -D -h /build -s /bin/bash build
chown -R build:build /build ${PSPDEV} ${{ matrix.package }}
cd ${{ matrix.package }}
sudo -u build PATH=${PATH} PSPDEV=${PSPDEV} LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH=0 ${PSPDEV}/bin/psp-makepkg --noconfirm
sudo -u build PATH=${PATH} PSPDEV=${PSPDEV} ${PSPDEV}/bin/psp-pacman -U --noconfirm *.pkg.tar.gz --overwrite '*'
cd ..
- name: Store package
run: |
echo ${{ matrix.package }}
- uses: actions/upload-artifact@v3
with:
name: package
path: ${{ matrix.package }}/*.pkg.tar.gz
build_depends:
needs: [prepare_jobs, build]
runs-on: ubuntu-latest
container: ghcr.io/pspdev/pspsdk:latest
strategy:
fail-fast: false
matrix:
package: ${{ fromJson(needs.prepare_jobs.outputs.dependant) }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Install package
run: |
adduser -D -h /build -s /bin/bash build
chown -R build:build /build ${PSPDEV} package
cd package
sudo -u build PATH=${PATH} PSPDEV=${PSPDEV} ${PSPDEV}/bin/psp-pacman -Udd --noconfirm *.pkg.tar.gz --overwrite '*'
cd ..
- name: Build packages
run: |
for f in ${{ matrix.package }}; do
chown -R build:build $f
cd $f
sudo -u build PATH=${PATH} PSPDEV=${PSPDEV} LIBMAKEPKG_LINT_PACKAGE_DOTFILES_SH=0 ${PSPDEV}/bin/psp-makepkg --noconfirm
sudo -u build PATH=${PATH} PSPDEV=${PSPDEV} ${PSPDEV}/bin/psp-pacman -U --noconfirm *.pkg.tar.gz --overwrite '*'
cd ..
done
- name: Store package
run: |
export PACKAGE=`echo ${{ matrix.package }} | awk '{print $NF}'`
echo "PACKAGE=$PACKAGE" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
with:
name: package
path: ${{ env.PACKAGE }}/*.pkg.tar.gz
create_release:
if: contains(github.ref,'refs/heads/master')
needs: [prepare_jobs, build, build_depends]
runs-on: ubuntu-latest
container: ghcr.io/pspdev/pspsdk:latest
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
- name: Install dependencies
run: |
apk --update add build-base bash gpgme-dev libarchive-tools libarchive-dev libtool doxygen libcrypto1.1
- name: Create repo files
if: contains(github.ref,'refs/heads/master')
run: |
cd package
${PSPDEV}/share/pacman/bin/repo-add pspdev.db.tar.gz *.pkg.tar.gz
- name: Upload files
if: contains(github.ref,'refs/heads/master')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: package/*
overwrite: true
file_glob: true
tag: ${{ github.ref }}-${{ github.run_id }}
release_name: ${{ github.ref }} (${{ github.run_id }})
docker-layer:
if: contains(github.ref,'refs/heads/master')
needs: [create_release]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract DOCKER_TAG using tag name
if: startsWith(github.ref, 'refs/tags/')
run: |
echo "DOCKER_TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Use default DOCKER_TAG
if: startsWith(github.ref, 'refs/tags/') != true
run: |
echo "DOCKER_TAG=latest" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github registry
uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
- uses: docker/build-push-action@v4
with:
push: true
tags: ghcr.io/${{ github.repository }}:${{ env.DOCKER_TAG }}
build-args: |
BASE_DOCKER_IMAGE=ghcr.io/${{ github.repository_owner }}/pspsdk:${{ env.DOCKER_TAG }}
PACKAGES_REPO=${{ github.repository }}
- name: Send Compile action
run: |
export DISPATCH_ACTION="$(echo run_build)"
echo "NEW_DISPATCH_ACTION=$DISPATCH_ACTION" >> $GITHUB_ENV
- name: Repository Dispatch to pspdev
uses: peter-evans/repository-dispatch@v2
with:
repository: ${{ github.repository_owner }}/pspdev
token: ${{ secrets.DISPATCH_TOKEN }}
event-type: ${{ env.NEW_DISPATCH_ACTION }}
client-payload: '{"ref": "${{ github.ref }}"}'