Skip to content

Add first attempt at actions file #30

Add first attempt at actions file

Add first attempt at actions file #30

Workflow file for this run

on:
push:
branches:
- main
pull_request:
branches:
- main
# from travis
# env:
# CHANGED_FILES: $(git diff --name-only $TRAVIS_COMMIT_RANGE)
jobs:
test:
runs-on: '${{ matrix.os }}'
strategy:
matrix:
os:
- ubuntu-latest
node-version:
- 14.x
# outputs:
# all: ${{steps.changes.outputs.all}}
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
# env:
# COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
# CHANGED_FILES_LIST: $(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }})
- name: Get changeset
run: |
echo 'CHANGED_FILES<<EOF' >> $GITHUB_ENV
$(git diff --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) >> $GITHUB_ENV
# echo 'EOF' >> $GITHUB_ENV
- name: Test1
run: echo $CHANGED_FILES
- 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'