-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 1.72 KB
/
release.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
on:
push:
tags:
- "*"
jobs:
check-main-branch:
runs-on: ubuntu-latest
outputs:
contains: ${{ steps.check.outputs.contains }}
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- id: check
run: |
branches=$(git branch --contains "$GITHUB_REF_NAME")
for branch in $branches; do
if [[ "$branch" == "main" ]]; then
echo "contains=true" >> "$GITHUB_OUTPUT"
exit 0
fi
done
echo "contains=false" >> "$GITHUB_OUTPUT"
build-book:
runs-on: ubuntu-latest
env:
# FIXME: duplicate of .github/workflows/main.yml:112
MDBOOK_VERSION: v0.4.36
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- run: |
curl -fsSL "$REPO_URL$RELEASE_DL_PATH/$MDBOOK_VERSION/$FILENAME" | tar xz
env:
REPO_URL: https://github.com/rust-lang/mdBook
RELEASE_DL_PATH: /releases/download
FILENAME: mdbook-${{ env.MDBOOK_VERSION }}-x86_64-unknown-linux-gnu.tar.gz
- run: |
./mdbook build
tar czf book.tar.gz book
- uses: actions/upload-artifact@v4
with:
name: book-archive
path: ./book.tar.gz
create-release:
runs-on: ubuntu-latest
needs: check-main-branch
if: ${{ needs.check-main-branch.outputs.contains == 'true' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/download-artifact@v4
with:
name: book-archive
- run: |
gh release create $GITHUB_REF_NAME book.tar.gz \
-d -t $GITHUB_REF_NAME -n "" --verify-tag