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

on:
  push:
    branches: [ "trunk" ]

jobs:
  build:

    runs-on: ubuntu-latest

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

    steps:
    - uses: actions/checkout@v5
    - name: Get changed files under src directory
      uses: dorny/paths-filter@v3
      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: 'yarn'
    - name: Install Node.js packages
      run: yarn install --immutable --immutable-cache

    - name: Run Eleventy Build
      run: yarn build
    - name: Run post-build
      if: steps.filter.outputs.source == 'true'
      run: yarn post-build
    - name: Commit public changes
      uses: actions-js/push@master
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        branch: trunk