-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (93 loc) · 3.24 KB
/
release.yml
File metadata and controls
107 lines (93 loc) · 3.24 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
105
106
107
name: Release and publish
on:
release:
types: [published]
concurrency:
group: release-${{ github.event.release.tag_name }}
cancel-in-progress: false
permissions:
contents: write
jobs:
release:
name: Build artifacts and publish Pages branch
runs-on: ubuntu-latest
env:
PAGES_BRANCH: pages
RELEASE_TAG: ${{ github.event.release.tag_name }}
steps:
- name: Checkout release tag
uses: actions/checkout@v6
with:
ref: refs/tags/${{ github.event.release.tag_name }}
fetch-depth: 0
submodules: recursive
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Build glotaran.org release
env:
SITE_URL: https://glotaran.org
run: |
npm run build
mv dist prod-dist
- name: Create release archive
run: |
ARCHIVE="glotaran-org-${RELEASE_TAG}.tar.gz"
tar -czf "$ARCHIVE" -C prod-dist .
sha256sum "$ARCHIVE" > "$ARCHIVE.sha256"
echo "ARCHIVE=${ARCHIVE}" >> "$GITHUB_ENV"
- name: Build glotaran.github.io site
env:
SITE_URL: https://glotaran.github.io
run: |
npm run build
mv dist pages-dist
rm -f pages-dist/CNAME
- name: Assemble Pages publish tree
run: |
mkdir publish
cp -a pages-dist/. publish/
cp -a external/glotaran.github.io/legacy publish/legacy
cp -a external/glotaran.github.io/_layouts publish/_layouts
printf '%s\n' 'theme: jekyll-theme-architect' 'include:' ' - _astro' > publish/_config.yml
- name: Create GitHub App token
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: glotaran
repositories: |
glotaran.github.io
permission-contents: write
- name: Resolve GitHub App bot user
id: app-bot
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
run: |
echo "user-id=$(gh api "/users/${APP_SLUG}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
- name: Publish glotaran.github.io Pages branch
env:
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
APP_TOKEN: ${{ steps.app-token.outputs.token }}
APP_BOT_USER_ID: ${{ steps.app-bot.outputs.user-id }}
run: |
cd publish
git init --initial-branch="$PAGES_BRANCH"
git config user.name "${APP_SLUG}[bot]"
git config user.email "${APP_BOT_USER_ID}+${APP_SLUG}[bot]@users.noreply.github.com"
git add --all
git commit --allow-empty -m "Publish ${RELEASE_TAG}"
git remote add origin "https://x-access-token:${APP_TOKEN}@github.com/glotaran/glotaran.github.io.git"
git push --force origin "HEAD:${PAGES_BRANCH}"
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
${{ env.ARCHIVE }}
${{ env.ARCHIVE }}.sha256