workflows: Add GitHub action for automating some release tasks
[llvm-project.git] / .github / workflows / release-tasks.yml
bloba87805b878607ac4cd39bddac651778bc52cb260
1 name: Release Task
3 on:
4   push:
5     tags:
6       # The regex support here is limited, so just match everything that starts with llvmorg- and filter later.
7       - 'llvmorg-*'
9 jobs:
10   release-tasks:
11     runs-on: ubuntu-latest
12     if: github.repository == 'llvm/llvm-project'
13     steps:
15     - name: Validate Tag
16       id: validate-tag
17       run: |
18         test "${{ github.actor }}" = "tstellar"
19         echo "${{ github.ref_name }}" | grep -e '^llvmorg-[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc[0-9]\+\)\?$'
20         release_version=`echo "${{ github.ref_name }}" | sed 's/llvmorg-//g'`
21         echo "::set-output name=release-version::$release_version"
23     - name: Install Dependencies
24       run: |
25         sudo apt-get install -y \
26             doxygen \
27             graphviz \
28             python3-github \
29             python3-recommonmark \
30             python3-sphinx \
31             ninja-build \
32             texlive-font-utils
33         pip3 install --user sphinx-markdown-tables
35     - name: Checkout LLVM
36       uses: actions/checkout@v3
38     - name: Create Release
39       run: |
40          ./llvm/utils/release/./github-upload-release.py --token ${{ github.token }} --release ${{ steps.validate-tag.outputs.release-version }} create
42     - name: Build Documentation
43       run: |
44         ./llvm/utils/release/build-docs.sh -srcdir llvm
45         ./llvm/utils/release/github-upload-release.py --token ${{ github.token }} --release ${{ steps.validate-tag.outputs.release-version }} upload --files *doxygen*.tar.xz
47     - name: Clone www-releases
48       if: ${{ !contains(steps.validate-tag.outputs.release-version, 'rc') }}
49       uses: actions/checkout@v3
50       with:
51         repository: ${{ github.repository_owner }}/www-releases
52         ref: main
53         fetch-depth: 0
54         path: www-releases
56     - name: Upload Release Notes
57       if: ${{ !contains(steps.validate-tag.outputs.release-version, 'rc') }}
58       run: |
59         mkdir -p ../www-releases/${{ steps.validate-tag.outputs.release-version }}
60         mv ./docs-build/html-export/* ../www-releases/${{ steps.validate-tag.outputs.release-version }}
61         cd ../www-releases
62         git add ${{ steps.validate-tag.outputs.release-version }}
63         git config user.email "llvmbot@llvm.org"
64         git config user.name "llvmbot"
65         git commit -a -m "Add ${{ steps.validate-tag.outputs.release-version }} documentation"
66         git push https://${{ secrets.WWW_RELEASES_TOKEN }}@github.com/${{ github.repository_owner }}/www-releases main:main