-
Notifications
You must be signed in to change notification settings - Fork 30
80 lines (79 loc) · 2.67 KB
/
github-actions-pullrequests.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
name: Build on Pull Request
on:
pull_request:
branches: [ master ]
types: [ opened, synchronize ]
jobs:
get-changed-files:
name: Retrieve changed files
runs-on: ubuntu-latest
steps:
- name: Checkout DeltaPorts repository (depth 2)
uses: actions/checkout@v3
with:
fetch-depth: 2 # OR "2" -> To retrieve the preceding commit.
- name: Get changed files
uses: tj-actions/changed-files@v41
id: changed-files
- name: Save all changed files to a temp file
run: |
for file in ${{ steps.changed-files.outputs.all_modified_files }}
do
echo "$file" >> changed-files.txt
done
- name: Display changed files
run: |
cat changed-files.txt
- name: Upload changed files
uses: actions/upload-artifact@v3
with:
name: changed-files
path: changed-files.txt
generate-and-build:
name: Generate index and build ports
runs-on: [ self-hosted, dports ]
timeout-minutes: 1200
needs: get-changed-files
steps:
- name: Retrieve changed files
uses: actions/download-artifact@v3
with:
name: changed-files
path: downloads
- name: Display changed files
run: |
cat downloads/changed-files.txt
- name: Parse changes
id: parsing
run: echo "dport=$(/root/bin/parse.sh $GITHUB_WORKSPACE/downloads/changed-files.txt)" >> $GITHUB_OUTPUT
- name: Setup chroot
run: /root/bin/setup_chroot.sh $GITHUB_WORKSPACE
- name: Checkout DeltaPorts repository
if: ${{ steps.parsing.outputs.dport != 'NOPORT' }}
uses: actions/checkout@v3
with:
path: DeltaPorts
- name: Checkout DPorts repository
if: ${{ steps.parsing.outputs.dport != 'NOPORT' }}
uses: actions/checkout@v3
with:
repository: DragonFlyBSD/DPorts
path: DPorts
ref: staged
- name: Checkout freebsd-ports repository
if: ${{ steps.parsing.outputs.dport != 'NOPORT' }}
uses: actions/checkout@v3
with:
ref: 2024Q1
repository: freebsd/freebsd-ports
path: freebsd-ports
persist-credentials: false
- name: Generate INDEX, merge DeltaPorts
if: ${{ steps.parsing.outputs.dport != 'NOPORT' }}
run: /root/bin/generate.sh "${{ steps.parsing.outputs.dport }}"
- name: Build port
if: ${{ steps.parsing.outputs.dport != 'NOPORT' }}
run: /root/bin/run.sh "${{ steps.parsing.outputs.dport }}"
- name: Cleanup chroot
if: always()
run: /root/bin/cleanup_chroot.sh $GITHUB_WORKSPACE