-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (57 loc) · 1.59 KB
/
Copy pathdeploy.yml
File metadata and controls
70 lines (57 loc) · 1.59 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
name: Build and Deploy
on:
push:
branches:
- main
repository_dispatch:
types:
- data-updated
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Setup Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x
- name: Test
run: deno task test
- name: Build
run: deno task build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./staging
force_orphan: true
disable_nojekyll: false
- name: Tag release
run: |
DATE=$(date -u +%Y.%m.%d)
# Collect all tags for today (bare date and date.N), sort by suffix numerically
EXISTING=$(git tag -l "${DATE}" "${DATE}.*" | sort -t. -k4 -n)
if [ -z "$EXISTING" ]; then
TAG="${DATE}"
else
LAST=$(echo "$EXISTING" | tail -1)
if [ "$LAST" = "${DATE}" ]; then
TAG="${DATE}.1"
else
SUFFIX="${LAST#${DATE}.}"
TAG="${DATE}.$((SUFFIX + 1))"
fi
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "$TAG"
git push origin "$TAG"
echo "Tagged: $TAG"