aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/release.yml
blob: 7c86c2835defe8a578a958532291507609249eb5 (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
name: Build and Publish
on:
  push:
    tags:
      - '*'

permissions:
  contents: read  #  to fetch code (actions/checkout)

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 7.4

      - name: Get the version
        id: get_version
        run: php .github/version.php "${GITHUB_REF}"

      - name: Build TGZ
        run: |
          rm -rf .gitignore
          rm -rf .git
          rm -rf .github
          rm -rf .gitattributes
          rm -rf _test
          rm -f .editorconfig
          mkdir -p data/pages/playground
          echo "====== PlayGround ======" > data/pages/playground/playground.txt
          cd ..
          mv dokuwiki "dokuwiki-${{ steps.get_version.outputs.VERSION }}"
          tar -czvf "dokuwiki-${{ steps.get_version.outputs.VERSION }}.tgz" dokuwiki-${{ steps.get_version.outputs.VERSION }}
          rm -rf "dokuwiki-${{ steps.get_version.outputs.VERSION }}"
          mkdir dokuwiki
          mv "dokuwiki-${{ steps.get_version.outputs.VERSION }}.tgz" dokuwiki/

      - name: Setup SSH Key
        uses: shimataro/ssh-key-action@v2
        with:
          key: ${{ secrets.SSH_PRIVATE_KEY }}
          # generate with ssh-keyscan -H <server>
          known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}

      - name: Deploy to Server
        run: |
          scp "dokuwiki-${{ steps.get_version.outputs.VERSION }}.tgz" ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:htdocs/src/dokuwiki/
          ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd htdocs/src/dokuwiki/ && tar -xzvf dokuwiki-${{ steps.get_version.outputs.VERSION }}.tgz"