Daily master build #30
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 | |
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' }} |