aboutsummaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/build.yml
blob: 05d1b2c84486bb3a2512afcb0bcda15c9f4b4e3a (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: submelon.dev build

on:
  push:
    branches: [ "trunk" ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [18.x]

    steps:
    - uses: actions/checkout@v4
    - name: Get changed files under src directory
      uses: dorny/paths-filter@v2
      id: filter
      with:
        filters: |
          source:
            - 'src/**'

    - name: Get current date
      id: date
      run: echo "DATE_VERSION=$(date +'%s')" >> $GITHUB_OUTPUT
    - name: Modify version number
      if: steps.filter.outputs.source == 'true'
      uses: jacobtomlinson/gha-find-replace@v3
      with:
        find: '"version": "[0-9]*",'
        replace: '"version": "${{ steps.date.outputs.DATE_VERSION }}",'
        include: 'config.json'

    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v4
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - name: Install Node.js packages
      run: npm ci

    - name: Run Eleventy Build
      run: npm run build
    - name: Run post-build
      run: npm run post-build
    - name: Commit public changes
      uses: actions-js/push@master
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        branch: trunk