Skip to content

Commit 4adca67

Browse files
committed
Deploy artifacts to github-pages
1 parent 6cee13c commit 4adca67

File tree

2 files changed

+93
-10
lines changed

2 files changed

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