-
-
Notifications
You must be signed in to change notification settings - Fork 4
88 lines (84 loc) · 2.89 KB
/
main.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
---
name: "Build & Deploy MacPorts Base for CI"
on:
release:
types:
- created
workflow_dispatch:
jobs:
build:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12, macos-13, macos-14]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 64
- name: Cleanup /usr/local
run: |
sudo mkdir /opt/local.old
sudo mv /usr/local/* /opt/local.old
- name: Fetch & Extract MacPorts Base
run: |
set -eu
tag=$(basename $GITHUB_REF)
version=$(echo $tag | colrm 1 1)
curl -LO https://github.com/macports/macports-base/releases/download/${tag}/MacPorts-${version}.tar.bz2 \
-O https://github.com/macports/macports-base/releases/download/${tag}/MacPorts-${version}.tar.bz2.sha256.sig
openssl dgst -sha256 -verify jmr-pubkey.pem -signature MacPorts-${version}.tar.bz2.sha256.sig \
MacPorts-${version}.tar.bz2
tar -xjf MacPorts-${version}.tar.bz2
mv MacPorts-${version} MacPorts
rm MacPorts-${version}.tar.bz2 MacPorts-${version}.tar.bz2.sha256.sig
- name: Configure MacPorts Base
run: |
set -eu
cd MacPorts
env PATH=/usr/bin:/bin:/usr/sbin:/sbin CFLAGS="-pipe -Os" ./configure
- name: Build MacPorts Base
run: |
set -eu
cd MacPorts
make -j$(sysctl -n hw.activecpu)
- name: Install MacPorts Base
run: |
set -eu
cd MacPorts
sudo make install
- name: Test MacPorts Base
continue-on-error: true
run: |
set -eu
cd MacPorts
make test
- name: Prepare Deployment
run: |
set -eu
tag=$(basename $GITHUB_REF)
version=$(echo $tag | colrm 1 1)
cd MacPorts
sed -i "" "s/-v selfupdate/version/" portmgr/dmg/postflight
sudo install -d -m755 /opt/local/libexec/macports/postflight
sudo install -m755 \
portmgr/dmg/postflight \
/opt/local/libexec/macports/postflight/
sudo install -m644 \
src/*.tcl \
/opt/local/libexec/macports/postflight/
os_major=$(uname -r | cut -f 1 -d .)
tar \
--exclude '/opt/local/var/macports/sip-workaround/?*' \
-cjf "../MacPorts-${version}-${os_major}.tar.bz2" \
/opt/local
- name: filename
run: echo "filename=MacPorts-$(echo $(basename $GITHUB_REF) | colrm 1 1)-$(uname -r | cut -f 1 -d .).tar.bz2" >> "$GITHUB_OUTPUT"
id: filename
- name: Deploy binary to release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ github.token }}
with:
files: ${{ format( '{0}', steps.filename.outputs.filename ) }}