0
votes

I have defined a little github action workflow, which is supposed to compile a kss-styleguide from scss.

The steps of that workflow basically trigger building the resulting css and the respective kss-styleguide.

When I run the build process locally on my dev machine the built styleguide is written to the styleguide folder located in the root of my project.

However on github, despite everything being marked off green, I don't know, what or where the resulting files are being written to.

How can I deploy the generated styleguide, if I don't know where it is?

Here's my yaml file for this workflow:


name: Node.js CI

on:
  push:
    branches: [ mk-node-ci ]
  pull_request:
    branches: [ mk-node-ci ]
jobs:
  build:
    name: Build Styleguide 
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [14.x]
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - uses: borales/[email protected] 
        with: 
          cmd: install 
        env: 
          NODE_ENV: development
      - name: "build CSS files" 
        uses: borales/[email protected] 
        with: 
          cmd: "build:css" 
      - name: "build styleguide files" 
        uses: borales/[email protected] 
        with: 
          cmd: "build:styleguide" 
1
Please post the logs of the the build steps of your action. Is the log different to the log when you're running it locally?riQQ

1 Answers

0
votes

Updated 2020.10.14 19:25 GMT

GitHub Actions are performed on a separate "clean" Runner Machine.

actions/checkout@v2 is an action that copies your repository to that machine — typically, to perform tests etc.

In order to get produced results (like modified files) from runner machine back to the original repository, we can use:

(1) upload-artifact action. (2) git push.

For example, here is my script to modify files from the source directory and put them into the output directory (I run it as an action (bash script): - run: wrap.sh). The script wrap.sh:

echo "Copy directory structure from 'in' to 'out':";
find ./in -type d | while read i;
do
    if [ ! -d "${i/in/out}" ]; then
        mkdir "${i/in/out}"
        echo "${i/in/out}";
    fi
done
echo "Wrap files:";
find ./in -type f -name "*" | while read i;
do
    echo "${i/in/out}";
    cat ./tpl/header.html "$i" ./tpl/footer.html >"${i/in/out}"
    git add "${i/in/out}"
done
git config user.name "chang-zhao"
git commit . -m "Wrapping"
git push origin main

Here git add "${i/in/out}" is adding to git a new file with that name. git config user.name "..." is required for the commit to work. git commit . -m "Wrapping" is the commit that puts new files into the repository ("Wrapping" is a name I gave to such commits).

This way files produced on a runner server get pushed to the original repository.