summaryrefslogtreecommitdiffstats
path: root/.github/workflows/post-release.yml
blob: 37481aeb0312e8b75ada4ab10ecc6c9d9f3e6eec (plain)
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
101
102
103
# Actions to run after releasing a version, like:
# - Generating documentation via mkdocs
# - Notifying packaging repos
# - Automatically creating winget packages

name: post-release

on:
  release:
    types: [published]

env:
  # Assign commit authorship to official Github Actions bot when pushing to the `gh-pages` branch:
  GIT_USER: "github-actions[bot]"
  GIT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"

jobs:
  docs:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
        with:
          fetch-depth: 0

      - name: Set env
        run: |
          export RELEASE_VERSION=${{ github.event.release.tag_name }}
          echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV

      - name: Test env
        run: |
          echo $RELEASE_VERSION

      - name: Make sure you're not on master/main/nightly...
        run: |
          if [[ $RELEASE_VERSION == "master" || $RELEASE_VERSION == "main" || $RELEASE_VERSION == "nightly" ]]; then
            exit 1
          fi

      - uses: actions/setup-python@bd6b4b6205c4dbad673328db7b31b7fab9e241c0 # v4.6.1
        with:
          python-version: 3.11

      - name: Install Python dependencies
        run: pip install -r docs/requirements.txt

      - name: Configure git user and email
        run: |
          git config --global user.name ${GIT_USER}
          git config --global user.email ${GIT_EMAIL}
          echo Name: $(git config --get user.name)
          echo Email: $(git config --get user.email)

      - name: Build and deploy docs with mike as the latest stable branch
        run: |
          cd docs
          OLD_STABLE_VERSION=$(mike list stable | grep -Po '([0-9]+.[0-9]+.[0-9]+)' | head -n1)
          echo ${OLD_STABLE_VERSION}
          mike retitle --push stable ${OLD_STABLE_VERSION}
          mike deploy --push --update-aliases ${RELEASE_VERSION} stable
          mike retitle --push ${RELEASE_VERSION} "${RELEASE_VERSION} (stable)"

  chocolatey:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

      - name: Set env
        run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

      - name: Test env
        run: |
          echo $RELEASE_VERSION

      - name: Make sure you're not on master/main/nightly...
        run: |
          if [[ $RELEASE_VERSION == "master" || $RELEASE_VERSION == "main" || $RELEASE_VERSION == "nightly" ]]; then
            exit 1
          fi

      - name: Trigger choco
        run: |
          curl -X POST https://api.github.com/repos/ClementTsang/choco-bottom/dispatches \
          -H 'Accept: application/vnd.github.everest-preview+json' \
          -u ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} \
          --data '{ "event_type": "update", "client_payload": { "version": "'"$RELEASE_VERSION"'" } }'

  winget:
    runs-on: windows-latest
    steps:
      - name: Make sure you're not on master/main/nightly...
        run: |
          if [[ $RELEASE_VERSION == "master" || $RELEASE_VERSION == "main" || $RELEASE_VERSION == "nightly" ]]; then
            exit 1
          fi

      - uses: vedantmgoyal2009/winget-releaser@79853c0938cc9946c1ec3cdd1b2e761bb0372b8c # v2
        with:
          identifier: Package.Identifier
          installers-regex: '^bottom_x86_64_installer\.msi$'
          token: ${{ secrets.WINGET_TOKEN }}