Add first attempt at actions file #32
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v39 | |
with: | |
since_last_remote_commit: true | |
- name: List all changed files | |
run: | | |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do | |
echo "$file was changed" | |
done | |
- name: push to env | |
run: | | |
echo "CHANGED_FILES=$steps.changed-files.outputs.all_changed_files" >> $GITHUB_ENV | |
# - 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' |