-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (62 loc) · 2.29 KB
/
build-containers.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
name: Build and Push Containers to GHCR
on:
workflow_dispatch: # Enables manual trigger from the GitHub UI
permissions:
contents: write
packages: write
attestations: write
id-token: write
jobs:
build:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Print Environment Variables
run: env
- name: Setup Environment
run: |
echo "HOME=/home/${{ secrets.HOST_USER_NAME }}" >> $GITHUB_ENV
echo "CACHED_OSX_SDK_PATH=/home/${{ secrets.HOST_USER_NAME }}/.cache/github-runners/build-containers/osx-sdk" >> $GITHUB_ENV
pip install gdown
- name: Print Environment Variables
run: env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Download Xcode
run: |
mkdir -p $CACHED_OSX_SDK_PATH
cd $CACHED_OSX_SDK_PATH
if ls Xcode_*.xip 1> /dev/null 2>&1; then
echo "Xcode file already exists, skipping download."
else
echo "Downloading Xcode..."
gdown ${{ secrets.XCODE_SDK_LINK }}
echo "Listing files in the current directory:"
ls -la
fi
- name: Build Godot Containers with Docker
run: |
chmod +x ${GITHUB_WORKSPACE}/build-containers/build.sh
cd ${GITHUB_WORKSPACE}/build-containers
./build.sh 4.3 f40 # Replace with the correct Godot branch and Fedora version as needed
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag and Push to GitHub Container Registry
run: |
docker images --format '{{.Repository}}:{{.Tag}}' | while read image; do
IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/$(basename $image)
docker tag $image $IMAGE_NAME
docker push $IMAGE_NAME
done
- name: Clean Up Dangling Images
run: |
docker images
docker rmi $(docker images -f "dangling=true" -q) || true # Ignore errors if no dangling images