Build & Deploy MacPorts Base for CI #25
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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-12, macos-13, macos-14, macos-15] | |
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: Select Xcode version | |
run: | | |
case "`uname -r`" in | |
22.*) sudo xcode-select --switch /Applications/Xcode_14.3.1.app/Contents/Developer | |
;; | |
23.*) sudo xcode-select --switch /Applications/Xcode_16.app/Contents/Developer | |
;; | |
esac | |
- name: Configure MacPorts Base | |
run: | | |
set -eu | |
cd MacPorts | |
./standard_configure.sh | |
- 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 ) }} |