diff --git a/.github/workflows/build_site/action.yml b/.github/workflows/build_site/action.yml new file mode 100644 index 00000000..d5837099 --- /dev/null +++ b/.github/workflows/build_site/action.yml @@ -0,0 +1,35 @@ +name: Build the site +description: Build the site using nanoc + +runs: + using: 'composite' + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Checkout submodule + shell: bash + run: git submodule update --init --recursive --remote + - name: Cache install Nix packages + uses: rikhuijzer/cache-install@c90964bcac3286c8571cb849f7caffb9e8b9cb37 + with: + key: nix-${{ hashFiles('packages.nix', 'gemset.nix') }} + nix_file: 'packages.nix' + - name: Cache Output + id: cache-output + uses: actions/cache@v4 + with: + path: | + ./tmp/ + ./output/ + key: build-${{ github.ref_name }} + restore-keys: | + build-master + - name: Set environment variable + shell: bash + run: "export LANG=en_US.UTF-8" + - name: Build site + shell: bash + run: "bundle exec nanoc --env=prod" + - name: Run checks + shell: bash + run: "bundle exec nanoc --env=prod check --deploy" \ No newline at end of file diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 30ac9b0e..fc9e3182 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -22,31 +22,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Checkout submodule - run: git submodule update --init --recursive --remote - - name: Cache install Nix packages - uses: rikhuijzer/cache-install@c90964bcac3286c8571cb849f7caffb9e8b9cb37 - with: - key: nix-${{ hashFiles('packages.nix', 'gemset.nix') }} - nix_file: 'packages.nix' - - name: Cache Output - id: cache-output - uses: actions/cache@v4 - with: - path: | - ./tmp/ - ./output/ - key: build-${{ github.ref_name }} - restore-keys: | - build-master - - name: Set environment variable - run: "export LANG=en_US.UTF-8" - - name: Build site - run: "bundle exec nanoc --env=prod" - - name: Run checks - run: "bundle exec nanoc --env=prod check --deploy" + - uses: ./.github/actions/build_site - name: Add private key shell: bash env: diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index a40e8777..ac450b93 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -20,31 +20,7 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Checkout submodule - run: git submodule update --init --recursive --remote - - name: Cache install Nix packages - uses: rikhuijzer/cache-install@c90964bcac3286c8571cb849f7caffb9e8b9cb37 - with: - key: nix-${{ hashFiles('packages.nix', 'gemset.nix') }} - nix_file: 'packages.nix' - - name: Cache Output - id: cache-output - uses: actions/cache@v4 - with: - path: | - ./tmp/ - ./output/ - key: build-${{ github.ref_name }} - restore-keys: | - build-master - - name: Set environment variable - run: "export LANG=en_US.UTF-8" - - name: Build site - run: "bundle exec nanoc --env=prod" - - name: Run checks - run: "bundle exec nanoc --env=prod check --deploy" + - uses: ./.github/actions/build_site - name: Add private key shell: bash env: