Skip to content

README.md: Update examples #68

README.md: Update examples

README.md: Update examples #68

Workflow file for this run

name: CI
on:
push:
branches: [dev, dist]
permissions:
contents: read
env:
GITHUB_ACTIONS: true
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}}-${{ matrix.node-version }}-node_modules-${{ hashFiles('package.json') }}
- name: Install dependencies
run: npm install
- name: Build alpine-typescript
run: npm run build-ci
- uses: actions/upload-artifact@v3
with:
name: test-build-output
path: |
./package.json
./index.d.ts
./index.js
./src/*.d.ts
./src/*.js
test-example-package:
name: Run example package tests
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3
with:
sparse-checkout: |
examples/package
sparse-checkout-cone-mode: false
- name: Move example files
run: |
mv ./examples/package/* ./
rm -rf ./examples/package
- uses: actions/download-artifact@v3
with:
name: test-build-output
path: ./alpine-typescript
- name: Update alpine-typescript file path
run: |
sed -i 's/file:..\/..\//file:alpine-typescript/g' package.json
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}}-${{ matrix.node-version }}-node_modules-${{ hashFiles('package.json') }}
- name: Install dependencies
run: npm install
- name: Build package example
run: npm run build-ci
test-example-project:
name: Run example project tests
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
fail-fast: true
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3
with:
sparse-checkout: |
examples/project
sparse-checkout-cone-mode: false
- name: Move example files
run: |
mv ./examples/project/* ./
rm -rf ./examples/project
- uses: actions/download-artifact@v3
with:
name: test-build-output
path: ./alpine-typescript
- name: Update alpine-typescript file path
run: |
sed -i 's/file:..\/..\//file:alpine-typescript/g' package.json
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}}-${{ matrix.node-version }}-node_modules-${{ hashFiles('package.json') }}
- name: Install dependencies
run: npm install
- name: Build package example
run: npm run build-ci
stage:
name: Stage changes as pull request
needs: [test, test-example-package, test-example-project]
runs-on: ubuntu-latest
timeout-minutes: 5
env:
NODE_VERSION: 18
if: github.ref == 'refs/heads/dev'
steps:
- run: 'echo "Staging dev changes"'
- uses: actions/checkout@v3
with:
ref: dist
- name: Reset branch
run: |
git fetch origin dev:dev
git reset --hard dev
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache node_modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package.json') }}
- name: Install dependencies
run: npm install
- name: Build alpine-typescript
run: npm run build-ci
- name: Add dist files
run: |
git add --force ./*.d.ts
git add --force ./*.js
git add --force ./**/*.d.ts
git add --force ./**/*.js
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.STAGE_DEPLOY_KEY }}
title: Merge dev changes to dist
branch: dev-to-dist
commit-message: '[create-pull-request] update tsc build dist files'
assignees: JackNoordhuis