summaryrefslogtreecommitdiff
path: root/.github/workflows/cd.yml
blob: 9627f662fcd9b1674a195cd8379abb45208bd359 (about) (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
---
# File : cd.yml

name: 'cd'
on:
  push:
    branches: [main]
defaults:
  run:
    shell: 'bash'
jobs:
  changes:
    runs-on: 'ubuntu-latest'
    outputs:
      ts: ${{ steps.filter.outputs.ts }}
    steps:
      - uses: actions/checkout@v2
      - name: '[check if build necessary]'
        uses: dorny/paths-filter@v2
        id: filter
        with:
          filters: |
            ts:
              - '**.ts'
              - '**.tsx'
              - '**.json'
  build-deploy:
    name: '[cd|build-deploy]'
    runs-on: 'ubuntu-latest'
    needs: changes
    if: ${{ needs.changes.outputs.ts == 'true' }}
    steps:
      - name: '[checkout] ${{ github.repository }} project'
        uses: 'actions/checkout@v2'
        with:
          repository: '${{ github.repository }}'
      - name: '[lint]'
        run: |
          echo TBA some linting
      - name: '[test]'
        run: |
          echo TBA some testing
      - name: '[build]'
        run: |
          git config --global url."https://github.com/".insteadOf ssh://[email protected]/
          git config --global url."https://".insteadOf git://
          git config --global url."https://".insteadOf ssh://
          npm install
          npm run build
          npm run export
      - name: '[Add GitHub Sponsors to Readme]'
        uses: JamesIves/[email protected]
        with:
          token: ${{secrets.PAT}}
          file: 'README.md'
          
      - name: '[commit changes]'
        run: |
          git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git config --local user.name "github-actions[bot]"
          git add .
          git commit -m "chore: build" -a
      - name: '[push changes]'
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          branch: ${{ github.ref }}
...
# End of cd.yml