-
Notifications
You must be signed in to change notification settings - Fork 5
110 lines (92 loc) · 3.2 KB
/
build.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Build
run-name: "${{ github.event_name == 'schedule' && 'Daily master build' || format('Release build for {0}', github.ref) }}"
permissions:
contents: write
on:
push:
tags:
- '*'
schedule:
- cron: '0 0 * * *'
jobs:
prepare-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and export
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
tags: builder-image:latest
outputs: type=docker,dest=/tmp/builder-image.tar
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: builder-image
path: /tmp/builder-image.tar
setup-vars:
runs-on: ubuntu-latest
steps:
- name: Setup matrix source
id: setup-vars
run: |
SOURCES='
{"name": "29.1", "repo": "emacs-mirror/emacs", ref: "emacs-29.1" },
{"name": "29.1_native_json_rpc", "repo": "blahgeek/emacs", ref: "b8e9c30dcae19eaa8deed9bd594e84d5cf6244cb" }
'
if [ $GITHUB_EVENT_NAME = "schedule" ]; then
SOURCES='
{"name": "master", "repo": "emacs-mirror/emacs", ref: "master" }
'
fi
echo sources=[$SOURCES] >> $GITHUB_OUTPUT
echo datetimestr=$(date +%Y%m%d-%H%M) >> $GITHUB_OUTPUT
outputs:
sources: ${{ steps.setup-vars.outputs.sources }}
datetimestr: ${{ steps.setup-vars.outputs.datetimestr }}
build-emacs:
runs-on: ubuntu-latest
needs:
- prepare-docker
- setup-vars
strategy:
matrix:
source: ${{ fromJson(needs.setup-vars.outputs.sources) }}
build_with_x11: [ "yes", "no" ]
steps:
- name: Install fuse
run: sudo apt-get install -y fuse libfuse2
- name: Checkout
uses: actions/checkout@v4
- name: Download emacs source from repo
uses: actions/checkout@v4
with:
repository: ${{ matrix.source.repo }}
ref: ${{ matrix.source.ref }}
path: emacs-src
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: builder-image
path: /tmp
- name: Load image
run: |
docker load -i /tmp/builder-image.tar
docker image ls -a
- name: Run and package
run: ./run-and-package.sh builder-image:latest ./emacs-src BUILD_WITH_X11=${{ matrix.build_with_x11 }}
- name: Upload binary to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/Emacs.AppImage
asset_name: Emacs-${{ matrix.source.name }}-${{ matrix.build_with_x11 == 'yes' && 'x11' || 'nox' }}.AppImage
tag: ${{ github.event_name == 'schedule' && format('daily-master-build-{0}', needs.setup-vars.outputs.datetimestr) || github.ref }}
release_name: "${{ github.event_name == 'schedule' && 'Daily master build' || 'Release build' }} ${{ needs.setup-vars.outputs.datetimestr }}"
prerelease: ${{ github.event_name == 'schedule' }}
make_latest: ${{ github.event_name != 'schedule' }}