forked from HandBrake/HandBrake-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (87 loc) · 2.53 KB
/
main.yml
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
name: Build
on:
push:
pull_request:
workflow_dispatch:
jobs:
handle_forks:
name: Forked Repo
runs-on: ubuntu-latest
if: github.repository != 'HandBrake/HandBrake-docs'
steps:
- name: Print Warning
run: |
echo "Builds are disabled for forked repositories."
build:
name: Build on Ubuntu
runs-on: ubuntu-latest
if: github.repository == 'HandBrake/HandBrake-docs'
steps:
- uses: actions/checkout@master
- name: Toolchain Cache
id: build-toolchain
uses: actions/cache@v3
with:
path: tools/local
key: build-toolchain
- name: Build Toolchain
if: steps.build-toolchain.outputs.cache-hit != 'true'
run: |
git submodule update --init
./build-tools
ls -la
- name: Build
run: |
bash ./marsh build --markdown="tools/local/bin/markdown"
gitrev=$(git rev-parse --short HEAD)
cd public
tar cvzf HandBrake_Documentation.$gitrev.tar.gz docs
cp *.tar.gz ../
cd ..
- uses: actions/upload-artifact@master
with:
name: docs
path: HandBrake_Documentation*.tar.gz
publish:
name: Publish Documentation
runs-on: ubuntu-latest
needs: build
if: github.repository == 'HandBrake/HandBrake-docs'
steps:
- uses: actions/checkout@v3
- name: Download Artifacts - Documentation
uses: actions/download-artifact@v4.1.7
with:
name: docs
path: docs/
# Generate Hashes
- name: Generate SHA265 Hashes
run: |
cd docs
sha256sum * > sha256.txt
cp sha256.txt ../.github/workflows/
cd ..
cd .github/workflows/
sed -e 's/ / | /' -i sha256.txt
sed -e 's/^/| /' -i sha256.txt
sed -e 's/$/ |/' -i sha256.txt
cat sha256.txt >> rel_body.md
# Publishing the Release
- name: Remove the old Release
uses: dev-drprasad/delete-older-releases@v0.2.1
with:
keep_latest: 0
delete_tag_pattern: "docs"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Release
uses: ncipollo/release-action@v1
with:
artifacts: "docs/*.*"
name: "Documentation"
bodyFile: .github/workflows/rel_body.md
prerelease: true
replacesArtifacts: false
allowUpdates: false
tag: docs
token: ${{ secrets.GITHUB_TOKEN }}