1+ name : Build Wine Prefixes with Docker
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ vendor :
7+ description : ' Proton vendor (only proton-ge supported)'
8+ required : true
9+ default : ' proton-ge'
10+ type : choice
11+ options :
12+ - proton-ge
13+ release_count :
14+ description : ' Number of releases to build'
15+ required : true
16+ default : ' 2'
17+ type : string
18+
19+ schedule :
20+ # Run weekly on Sundays at 06:00 UTC
21+ - cron : ' 0 6 * * 0'
22+
23+ push :
24+ branches : [ main ]
25+ paths :
26+ - ' Dockerfile'
27+ - ' docker-scripts/**'
28+ - ' .github/workflows/build-prefixes-docker.yml'
29+
30+ env :
31+ REGISTRY : ghcr.io
32+ IMAGE_NAME : ${{ github.repository }}/wine-prefix-builder
33+
34+ jobs :
35+ fetch-releases :
36+ runs-on : ubuntu-latest
37+ outputs :
38+ matrix : ${{ steps.generate-matrix.outputs.matrix }}
39+ steps :
40+ - name : Checkout repository
41+ uses : actions/checkout@v4
42+
43+ - name : Fetch Proton releases
44+ id : fetch-releases
45+ run : |
46+ chmod +x scripts/fetch-proton-releases.sh
47+
48+ VENDOR="${{ github.event.inputs.vendor || 'proton-ge' }}"
49+ COUNT="${{ github.event.inputs.release_count || '2' }}"
50+
51+ echo "Fetching releases with vendor: $VENDOR, count: $COUNT"
52+
53+ # Create output directory
54+ mkdir -p release-data
55+
56+ # Fetch releases
57+ ./scripts/fetch-proton-releases.sh "$VENDOR" urls "$COUNT" > release-data/releases.txt
58+
59+ echo "Release data:"
60+ cat release-data/releases.txt
61+
62+ - name : Generate build matrix
63+ id : generate-matrix
64+ run : |
65+ # Convert release URLs to GitHub Actions matrix format
66+ matrix_items=()
67+
68+ while IFS='|' read -r vendor version url; do
69+ if [[ -n "$vendor" && -n "$version" && -n "$url" ]]; then
70+ matrix_items+=("{\"vendor\":\"$vendor\",\"version\":\"$version\",\"url\":\"$url\"}")
71+ fi
72+ done < release-data/releases.txt
73+
74+ # Join matrix items
75+ matrix_json="[$(IFS=','; echo "${matrix_items[*]}")]"
76+ echo "Generated matrix: $matrix_json"
77+ echo "matrix=$matrix_json" >> $GITHUB_OUTPUT
78+
79+ build-image :
80+ runs-on : ubuntu-latest
81+ permissions :
82+ contents : read
83+ packages : write
84+ outputs :
85+ image : ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
86+ digest : ${{ steps.build.outputs.digest }}
87+ steps :
88+ - name : Checkout repository
89+ uses : actions/checkout@v4
90+
91+ - name : Set up Docker Buildx
92+ uses : docker/setup-buildx-action@v3
93+
94+ - name : Log in to Container Registry
95+ uses : docker/login-action@v3
96+ with :
97+ registry : ${{ env.REGISTRY }}
98+ username : ${{ github.actor }}
99+ password : ${{ secrets.GITHUB_TOKEN }}
100+
101+ - name : Extract metadata
102+ id : meta
103+ uses : docker/metadata-action@v5
104+ with :
105+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
106+ tags : |
107+ type=sha
108+ type=raw,value=latest,enable={{is_default_branch}}
109+
110+ - name : Build and push Docker image
111+ id : build
112+ uses : docker/build-push-action@v5
113+ with :
114+ context : .
115+ push : true
116+ tags : ${{ steps.meta.outputs.tags }}
117+ labels : ${{ steps.meta.outputs.labels }}
118+ cache-from : type=gha
119+ cache-to : type=gha,mode=max
120+
121+ build-prefixes :
122+ runs-on : ubuntu-latest
123+ needs : [fetch-releases, build-image]
124+ if : needs.fetch-releases.outputs.matrix != '[]'
125+ strategy :
126+ fail-fast : false
127+ matrix :
128+ include : ${{ fromJson(needs.fetch-releases.outputs.matrix) }}
129+
130+ container :
131+ image : ${{ needs.build-image.outputs.image }}
132+ options : --privileged
133+
134+ steps :
135+ - name : Checkout repository
136+ uses : actions/checkout@v4
137+
138+ - name : Create output directory
139+ run : |
140+ mkdir -p /output
141+ chmod 777 /output
142+
143+ - name : Build Wine prefix
144+ run : |
145+ echo "Building Wine prefix for ${{ matrix.vendor }} ${{ matrix.version }}"
146+ echo "Source URL: ${{ matrix.url }}"
147+
148+ # Copy scripts to container
149+ cp -r docker-scripts/* /scripts/
150+ chmod +x /scripts/*.sh
151+
152+ # Run the prefix builder
153+ /scripts/build-prefix.sh "${{ matrix.url }}" /output
154+ env :
155+ DISPLAY : :99
156+
157+ - name : Upload artifacts
158+ uses : actions/upload-artifact@v4
159+ with :
160+ name : wine-prefix-${{ matrix.vendor }}-${{ matrix.version }}
161+ path : /output/
162+ retention-days : 30
163+
164+ create-release :
165+ runs-on : ubuntu-latest
166+ needs : [build-prefixes]
167+ if : startsWith(github.ref, 'refs/tags/')
168+ permissions :
169+ contents : write
170+ steps :
171+ - name : Checkout repository
172+ uses : actions/checkout@v4
173+
174+ - name : Download all artifacts
175+ uses : actions/download-artifact@v4
176+ with :
177+ path : ./artifacts
178+
179+ - name : Prepare release assets
180+ run : |
181+ mkdir -p release-assets
182+
183+ # Collect all archives and metadata
184+ find artifacts/ -name "*.tar.gz" -exec cp {} release-assets/ \;
185+ find artifacts/ -name "*.zip" -exec cp {} release-assets/ \;
186+ find artifacts/ -name "*.json" -exec cp {} release-assets/ \;
187+
188+ # Create combined metadata
189+ echo '{"prefixes":[' > release-assets/all-prefixes.json
190+ find artifacts/ -name "*.json" -exec cat {} \; | sed 's/^/,/' | sed '1s/^,//' >> release-assets/all-prefixes.json
191+ echo ']}' >> release-assets/all-prefixes.json
192+
193+ echo "Release assets prepared:"
194+ ls -la release-assets/
195+
196+ - name : Create GitHub Release
197+ uses : softprops/action-gh-release@v1
198+ with :
199+ files : release-assets/*
200+ body : |
201+ # Wine Prefixes Release ${{ github.ref_name }}
202+
203+ This release contains pre-built Wine prefixes for various Proton versions.
204+
205+ ## Usage
206+
207+ 1. Download the desired prefix archive (`.tar.gz` or `.zip`)
208+ 2. Extract the archive
209+ 3. Run `./scripts/install-prefix.sh` to install
210+ 4. Use `./run-app.sh /path/to/app.exe` to run applications
211+
212+ ## Available Prefixes
213+
214+ Check the `all-prefixes.json` file for complete metadata about all included prefixes.
215+
216+ ## Build Information
217+
218+ - Built with: Docker Wine Prefix Builder
219+ - Build date: ${{ github.run_number }}
220+ - Commit: ${{ github.sha }}
221+ draft : false
222+ prerelease : false
0 commit comments