Skip to content

Add first attempt at actions file #36

Add first attempt at actions file

Add first attempt at actions file #36

Workflow file for this run

on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
node-version:
- 14.x
steps:
- name: 'Set up Node.js ${{ matrix.node-version }}'
uses: actions/setup-node@v1
with:
node-version: '${{ matrix.node-version }}'
- name: Cache node modules
uses: actions/cache@v3
with:
path: ~/.npm
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }}
restore-keys: v1-npm-deps-
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed_files
uses: tj-actions/changed-files@v39
with:
since_last_remote_commit: true
- name: Save changed files to environment variable
run: |
csv=""
for result in ${{ steps.changed_files.outputs.all_changed_files }}; do
file="$result"
csv="${csv}${csv:+,}$file"
done
echo "CHANGED_FILES=$csv" >> $GITHUB_ENV
- name: Test1
run: env
# - name: Test2
# run: echo env.CHANGED_FILES
# - name: Run build (test, validate)
# run: 'npm ci'
# run: 'npm run bootstrap && npm run build:ci'
publish:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
node-version:
- 14.x
# if: ${{ github.event_name != 'pull_request' }}
if: github.ref == 'refs/heads/main'
steps:
- name: Publish Package(s)
run: 'npm run publish'
# run: |
# echo "::set-output name=all::$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | xargs)"
# from travis
# - run: >-
# if [[ $TRAVIS_PULL_REQUEST = "false" ]]; then PUBLISH_PACKAGE=true;
# else PUBLISH_PACKAGE=false; fi
# - run: >-
# echo "Pull Request: $TRAVIS_PULL_REQUEST" && echo "Node:
# $TRAVIS_NODE_VERSION" && echo "Publish? $PUBLISH_PACKAGE"
# - run: 'if [ $PUBLISH_PACKAGE = "true" ]; then npm run publish; fi'