-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (42 loc) · 1.58 KB
/
webUpdate.yml
File metadata and controls
52 lines (42 loc) · 1.58 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
name: Web Update
on:
repository_dispatch:
types: [new_release]
workflow_dispatch:
push:
branches: [main]
permissions:
contents: write
jobs:
gh-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build site
run: mkdir output && cp src/* output/
- name: Replace version in template
env:
LATEST_TAG: ${{ steps.latest_version.outputs.latest_tag }}
run: |
set -o errexit
set -o pipefail
releases_json=$(curl https://api.github.com/repos/dn-vm/dnvm/releases)
latest_stable=$(echo "$releases_json" | jq -r '. | map(select(.prerelease == false)) | .[0].tag_name')
latest_preview=$(echo "$releases_json" | jq -r '. | map(select(.prerelease == true)) | .[0].tag_name')
echo "Latest stable: $latest_stable"
echo "Latest preview: $latest_preview"
sed -i'.bak' "s/__latestVersion__/${latest_stable:1}/g" ./output/*.template
sed -i'.bak' "s/__latestPreview__/${latest_preview:1}/g" ./output/*.template
- name: Move templates to final name
run: mv ./output/install.sh.template ./output/install.sh &&
mv ./output/install.ps1.template ./output/install.ps1 &&
mv ./output/releases.json.template ./output/releases.json &&
rm ./output/*.template.bak
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./output