Skip to content

Commit 41928d6

Browse files
committed
Deploy artifacts to github-pages
1 parent 6cee13c commit 41928d6

File tree

2 files changed

+96
-10
lines changed

2 files changed

+96
-10
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy Jekyll site and static content to Pages
3+
4+
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
5+
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
6+
7+
on:
8+
# Run on master branch after the static builds are successful
9+
workflow_run:
10+
workflows: ["Generate static binaries"]
11+
branches: [$default-branch]
12+
types:
13+
- completed
14+
15+
# Allows you to run this workflow manually from the Actions tab
16+
workflow_dispatch:
17+
18+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
19+
permissions:
20+
contents: read
21+
pages: write
22+
id-token: write
23+
24+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
25+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
26+
concurrency:
27+
group: "pages"
28+
cancel-in-progress: false
29+
30+
jobs:
31+
# Build job
32+
build:
33+
runs-on: ubuntu-latest
34+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
- name: Setup Pages
39+
uses: actions/configure-pages@v4
40+
- name: Build with Jekyll
41+
uses: actions/jekyll-build-pages@v1
42+
with:
43+
source: ./
44+
destination: ./_site
45+
# Not the default gh download-artifact action, which doesn't work
46+
# between workflows
47+
- name: Get previous artifact learn-ocaml-www.zip
48+
uses: dawidd6/action-download-artifact@v2
49+
with:
50+
workflow: ${{ github.event.workflow_run.workflow_id }}
51+
name: learn-ocaml-www.zip
52+
path: _site/artifacts/
53+
- name: Get previous artifact learn-ocaml-linux-x86_64
54+
uses: dawidd6/action-download-artifact@v2
55+
with:
56+
workflow: ${{ github.event.workflow_run.workflow_id }}
57+
name: learn-ocaml-linux-x86_64
58+
path: _site/artifacts/
59+
- name: Get previous artifact learn-ocaml-darwin-x86_64
60+
uses: dawidd6/action-download-artifact@v2
61+
with:
62+
workflow: ${{ github.event.workflow_run.workflow_id }}
63+
name: learn-ocaml-darwin-x86_64
64+
path: _site/artifacts/
65+
- name: Generate HTML index
66+
run: |
67+
cd _site/artifacts
68+
tree -H . -L 1 --noreport --dirsfirst -T Learn-ocaml latest development artifacts' --charset utf-8 -o index.html
69+
- name: Upload artifact
70+
uses: actions/upload-pages-artifact@v2
71+
72+
# Deployment job
73+
deploy:
74+
# Don't run if tests failed
75+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
76+
environment:
77+
name: github-pages
78+
url: ${{ steps.deployment.outputs.page_url }}
79+
runs-on: ubuntu-latest
80+
needs: build
81+
steps:
82+
- name: Deploy to GitHub Pages
83+
id: deployment
84+
uses: actions/deploy-pages@v3

.github/workflows/static-builds.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Generate static binaries
22
on:
33
push:
44
branches:
5-
- master
5+
- $default-branch
66
tags:
77
- '*'
88
pull_request:
@@ -11,6 +11,9 @@ on:
1111
schedule:
1212
# test master every Saturday at 08:00 UTC
1313
- cron: '0 8 * * 6'
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
1417
jobs:
1518
learn-ocaml-www-zip:
1619
name: Build learn-ocaml-www.zip archive
@@ -41,7 +44,7 @@ jobs:
4144
runs-on: ubuntu-latest
4245
strategy:
4346
matrix:
44-
artifact: ["learn-ocaml-linux-x86_64.tar.gz"]
47+
artifact: ["learn-ocaml-linux-x86_64"]
4548
# we could use an env var, albeit it would be less convenient
4649
steps:
4750
- name: Check out the repo
@@ -57,13 +60,13 @@ jobs:
5760
- name: Archive static binaries
5861
run: |
5962
uname -a
60-
tar cvzf ${{ matrix.artifact }} \
61-
learn-ocaml learn-ocaml-server learn-ocaml-client
63+
mkdir -p ${{ matrix.artifact }}
64+
cp learn-ocaml learn-ocaml-server learn-ocaml-client ${{ matrix.artifact }}
6265
- name: Upload static binaries
6366
uses: actions/upload-artifact@v2
6467
with:
6568
name: ${{ matrix.artifact }}
66-
path: ${{ matrix.artifact }}
69+
path: ${{ matrix.artifact }}/*
6770
static-bin-macos:
6871
name: Builds static Macos binaries
6972
if: ${{ github.event_name != 'schedule' || github.repository == 'ocaml-sf/learn-ocaml' }}
@@ -73,7 +76,7 @@ jobs:
7376
OPAMDEPEXTYES: 1
7477
strategy:
7578
matrix:
76-
artifact: ["learn-ocaml-darwin-x86_64.tar.gz"]
79+
artifact: ["learn-ocaml-darwin-x86_64"]
7780
# we could use an env var, albeit it would be less convenient
7881
steps:
7982
- name: Check out the repo
@@ -107,11 +110,10 @@ jobs:
107110
- name: Archive static binaries
108111
run: |
109112
uname -a
110-
cd _build/install/default/bin
111-
tar cvzhf "$OLDPWD"/${{ matrix.artifact }} \
112-
learn-ocaml learn-ocaml-server learn-ocaml-client
113+
mkdir -p ${{ matrix.artifact }}
114+
cp _build/install/default/bin/learn-ocaml{,-server,-client} ${{ matrix.artifact }}
113115
- name: Upload static binaries
114116
uses: actions/upload-artifact@v2
115117
with:
116118
name: ${{ matrix.artifact }}
117-
path: ${{ matrix.artifact }}
119+
path: ${{ matrix.artifact }}/*

0 commit comments

Comments
 (0)