aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/jekyll.yml
blob: 23a8a1a9dbba486b30477d506564bfc590d4ee00 (plain) (blame)
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
name: Jekyll

on:
  workflow_call:
  workflow_dispatch:

jobs:
  maintenance:
    strategy:
      matrix:
        project:
          - repo: blog
            branch: gh-pages
          - repo: egor-tensin.github.io
            branch: master
          - repo: fucktipp.ing
            branch: master
          - repo: jekyll-theme
            branch: master
          - repo: sorting-algorithms
            branch:  gh-pages
          - repo: wireguard-config
            branch: master
    runs-on: ubuntu-latest
    name: '${{ matrix.project.repo }}'
    env:
      GH_TOKEN: '${{ github.token }}'
    steps:
      - name: Configure SSH
        run: |
          mkdir -p ~/.ssh
          cat > ~/.ssh/config <<'EOF'
          StrictHostKeyChecking no
          EOF
      - name: Set up ssh-agent
        uses: webfactory/ssh-agent@v0.9.0
        with:
          ssh-private-key: '${{ secrets.SSH_KEY }}'
      - name: Checkout
        run: |
          git clone -q --single-branch --branch '${{ matrix.project.branch }}' \
              'ssh://git@github.com/egor-tensin/${{ matrix.project.repo }}.git'
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
          working-directory: '${{ matrix.project.repo }}'
      - name: Configure git
        run: |
          git config --global user.name 'Egor Tensin'
          git config --global user.email 'egor@tensin.name'
      - name: Run maintenance
        id: maintenance
        run: |
          cd -- '${{ matrix.project.repo }}'
          make maintenance
          commit="$( git rev-parse HEAD )"
          echo "commit=$commit" >> "$GITHUB_OUTPUT"
      - name: Wait until the run is finished
        run: |
          sleep 10
          cd -- '${{ matrix.project.repo }}'
          commit='${{ steps.maintenance.outputs.commit }}'
          run_id="$( gh run list --commit "$commit" --json databaseId --jq '.[0].databaseId' )"
          gh run watch --compact --exit-status "$run_id"