-
Notifications
You must be signed in to change notification settings - Fork 14
132 lines (117 loc) · 4.06 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Packages
on:
push:
pull_request:
repository_dispatch:
types: [run_build]
jobs:
prepare_jobs:
runs-on: ubuntu-latest
container: python:3-alpine
steps:
- uses: actions/checkout@v4
- name: Generate build list
id: set-matrix
run: |
echo "build_list=$(./get_depends.py)" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
outputs:
build_list: ${{ steps.set-matrix.outputs.build_list }}
build:
needs: [prepare_jobs]
runs-on: ubuntu-latest
container: ghcr.io/pspdev/pspsdk:latest
strategy:
fail-fast: false
matrix:
packages: ${{ fromJson(needs.prepare_jobs.outputs.build_list) }}
steps:
- uses: actions/checkout@v4
- name: Build packages
run: |
adduser -D -h /build -s /bin/bash build
chown -R build:build /build ${PSPDEV}
for f in ${{ matrix.packages }}; 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.packages }} | awk '{print $NF}'`
echo "PACKAGE=$PACKAGE" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: artifact-${{ env.PACKAGE }}
path: ${{ env.PACKAGE }}/*.pkg.tar.gz
create_release:
if: contains(github.ref,'refs/heads/master')
needs: [prepare_jobs, build]
runs-on: ubuntu-latest
container: ghcr.io/pspdev/pspsdk:latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
- name: Install dependencies
run: |
apk --update add build-base bash gpgme-dev libarchive-tools libarchive-dev libtool doxygen libcrypto3
- name: Create repo files
if: contains(github.ref,'refs/heads/master')
run: |
mkdir package
cp artifact-*/*.pkg.tar.gz package/
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@v4
- 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@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github registry
uses: docker/login-action@v3
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
- uses: docker/build-push-action@v5
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 }}
- 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@v3
with:
repository: ${{ github.repository_owner }}/pspdev
token: ${{ secrets.DISPATCH_TOKEN }}
event-type: ${{ env.NEW_DISPATCH_ACTION }}
client-payload: '{"ref": "${{ github.ref }}"}'