Skip to content

Merge pull request #28 from NxtLvLSoftware/dev-to-dist #75

Merge pull request #28 from NxtLvLSoftware/dev-to-dist

Merge pull request #28 from NxtLvLSoftware/dev-to-dist #75

Workflow file for this run

name: CI
on:
push:
branches: [dev, dist]
permissions:
contents: read
env:
GITHUB_ACTIONS: true
NODE_VERSION: 20
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- 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 run clean-install
- name: Build alpine-typescript
run: npm run build-dist
- uses: actions/upload-artifact@v3
with:
name: test-build-output
path: |
./package.json
./dist/*.js
./types/*.d.ts
test-example-package:
name: Run example package tests
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 5
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 ${{ 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 run clean-install
- name: Build package example
run: npm run build-dist
test-example-project:
name: Run example project tests
needs: [test]
runs-on: ubuntu-latest
timeout-minutes: 5
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 ${{ 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 run clean-install
- name: Build package example
run: npm run build-dist
stage:
name: Stage changes as pull request
needs: [test, test-example-package, test-example-project]
runs-on: ubuntu-latest
timeout-minutes: 5
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 run clean-install
- name: Build alpine-typescript
run: npm run build-dist
- name: Add dist files
run: |
git rm -r --force ./src
git add --force ./dist
git add --force ./types
- 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