-
-
Notifications
You must be signed in to change notification settings - Fork 216
104 lines (93 loc) · 3.09 KB
/
Copy pathrelease-windows.yml
File metadata and controls
104 lines (93 loc) · 3.09 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Release Windows installer
on:
push:
tags:
- 'V*'
workflow_dispatch:
inputs:
ref:
description: 'Git ref (branch or tag) to build'
required: true
default: 'master'
env:
IMAGE: ghcr.io/swi-prolog/swipl-mingw-build:latest
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: read
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
swap-storage: true
- name: Resolve build ref
id: ref
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "ref=${{ inputs.ref }}" >> "$GITHUB_OUTPUT"
else
echo "ref=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull build image
run: docker pull "$IMAGE"
- name: Cross-build Windows installer
run: |
docker run --name swipl-build \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
"$IMAGE" \
--win64-from-git \
https://github.com/${{ github.repository }}.git \
"${{ steps.ref.outputs.ref }}"
- name: Extract installer
id: extract
run: |
mkdir -p out
# docker cp <container>:<dir> - streams the directory as a tar
# to stdout. Extract only the installer to sidestep the
# safety check that rejects escaping symlinks elsewhere in
# build.win64/.
docker cp swipl-build:/home/swipl/src/swipl-devel/build.win64 - | \
tar -x -C out/ --strip-components=1 --wildcards \
'build.win64/swipl-*-*.x64.exe'
docker rm swipl-build
installer=$(ls out/swipl-*.x64.exe 2>/dev/null | head -n1)
if [ -z "$installer" ]; then
echo "No installer produced" >&2
ls -la out/ >&2
exit 1
fi
echo "path=$installer" >> "$GITHUB_OUTPUT"
echo "name=$(basename "$installer")" >> "$GITHUB_OUTPUT"
sha256sum "$installer" | tee "$installer.sha256"
- name: Upload as workflow artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.extract.outputs.name }}
path: |
${{ steps.extract.outputs.path }}
${{ steps.extract.outputs.path }}.sha256
- name: Publish to GitHub Release
if: startsWith(github.ref, 'refs/tags/V')
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
${{ steps.extract.outputs.path }}
${{ steps.extract.outputs.path }}.sha256