Skip to content

Commit

Permalink
Merge pull request #38 from NxtLvLSoftware/dev-to-dist
Browse files Browse the repository at this point in the history
Merge dev changes to dist
  • Loading branch information
JackNoordhuis authored Dec 11, 2024
2 parents 830b856 + 8e38a77 commit 86f847f
Show file tree
Hide file tree
Showing 15 changed files with 5,510 additions and 7,830 deletions.
102 changes: 55 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ permissions:

env:
GITHUB_ACTIONS: true
NODE_VERSION: 20
NODE_VERSION: 22
PNPM_VERSION: 9

jobs:
test:
Expand All @@ -20,26 +21,28 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
- name: Use pnpm ${{ env.PNPM_VERSION }}
uses: pnpm/action-setup@v4
with:
node-version: ${{ env.NODE_VERSION }}
version: ${{ env.PNPM_VERSION }}
run_install: false

- name: Cache node_modules
uses: actions/cache@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
path: node_modules
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package.json') }}
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm run clean-install
run: pnpm run clean-install

- name: Build alpine-typescript
run: npm run build-dist
run: pnpm run build-dist

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: test-build-output
path: |
Expand All @@ -54,7 +57,7 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
sparse-checkout: |
examples/package
Expand All @@ -65,7 +68,7 @@ jobs:
mv ./examples/package/* ./
rm -rf ./examples/package
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: test-build-output
path: ./alpine-typescript
Expand All @@ -74,22 +77,24 @@ jobs:
run: |
sed -i 's/file:..\/..\//file:alpine-typescript/g' package.json
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
- name: Use pnpm ${{ env.PNPM_VERSION }}
uses: pnpm/action-setup@v4
with:
node-version: ${{ env.NODE_VERSION }}
version: ${{ env.PNPM_VERSION }}
run_install: false

- name: Cache node_modules
uses: actions/cache@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
path: node_modules
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package.json') }}
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm run clean-install
run: pnpm run clean-install

- name: Build package example
run: npm run build-dist
run: pnpm run build-dist

test-example-project:
name: Run example project tests
Expand All @@ -98,7 +103,7 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
sparse-checkout: |
examples/project
Expand All @@ -109,7 +114,7 @@ jobs:
mv ./examples/project/* ./
rm -rf ./examples/project
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: test-build-output
path: ./alpine-typescript
Expand All @@ -118,22 +123,23 @@ jobs:
run: |
sed -i 's/file:..\/..\//file:alpine-typescript/g' package.json
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
- name: Use pnpm ${{ env.PNPM_VERSION }}
uses: pnpm/action-setup@v4
with:
node-version: ${{ env.NODE_VERSION }}
version: ${{ env.PNPM_VERSION }}
run_install: false

- name: Cache node_modules
uses: actions/cache@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
path: node_modules
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package.json') }}
node-version: ${{ env.NODE_VERSION }}
cache: pnpm

- name: Install dependencies
run: npm run clean-install
run: pnpm run clean && pnpm add ./alpine-typescript

- name: Build package example
run: npm run build-dist
run: pnpm run build-dist

stage:
name: Stage changes as pull request
Expand All @@ -144,7 +150,7 @@ jobs:
if: github.event_name == 'push'
steps:
- run: 'echo "Staging dev changes"'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: dist

Expand All @@ -153,31 +159,33 @@ jobs:
git fetch origin dev:dev
git reset --hard dev
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
- name: Use pnpm ${{ env.PNPM_VERSION }}
uses: pnpm/action-setup@v4
with:
node-version: ${{ env.NODE_VERSION }}
version: ${{ env.PNPM_VERSION }}
run_install: false

- name: Cache node_modules
uses: actions/cache@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
path: node_modules
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package.json') }}
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: 'package.json'

- name: Install dependencies
run: npm run clean-install
run: pnpm run clean-install

- name: Build alpine-typescript
run: npm run build-dist
run: pnpm run build-dist

- name: Add dist files
run: |
git rm -r --force ./src
git add --force ./dist
git add --force ./types
git add --force ./dist/*.js
git add --force ./types/*.d.ts
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.STAGE_DEPLOY_KEY }}
title: Merge dev changes to dist
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/package-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ concurrency:

env:
GITHUB_ACTIONS: true
NODE_VERSION: 20
NODE_VERSION: 22
PNPM_VERSION: 9

jobs:
publish:
Expand All @@ -27,7 +28,7 @@ jobs:
- uses: actions/checkout@v4

- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
Expand Down
46 changes: 18 additions & 28 deletions .github/workflows/pages-publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Publish Pages

on:
push:
workflow_run:
workflows: ['Publish Package']
branches: [dist]
types: [completed]

permissions:
contents: write
Expand All @@ -13,43 +15,31 @@ concurrency:

env:
GITHUB_ACTIONS: true
NODE_VERSION: 20
NODE_VERSION: 22
PNPM_VERSION: 9

jobs:
wait-for-package-publish:
name: Wait for package publish workflow success
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Wait for publish success
uses: lewagon/[email protected]
with:
ref: ${{ github.ref }}
check-name: Publish to npm registry
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10

build-docs:
name: Generate site
needs: [wait-for-package-publish]
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}

- name: Remove README.md index lines
run: |
sed -i '28,127d' README.md
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package.json') }}
Expand All @@ -64,7 +54,7 @@ jobs:
run: |
cp ./.github/favicon.ico ./docs-build/favicon.ico
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pages-docs-html
path: ./docs-build
Expand All @@ -76,7 +66,7 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
sparse-checkout: |
examples/project
Expand All @@ -92,12 +82,12 @@ jobs:
sed -i 's/file:..\/..\//rc/g' package.json
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Cache node_modules
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}}-${{ env.NODE_VERSION }}-node_modules-${{ hashFiles('package.json') }}
Expand All @@ -108,7 +98,7 @@ jobs:
- name: Build example project
run: npm run build-dist

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: pages-example-html
path: ./dist
Expand All @@ -120,12 +110,12 @@ jobs:
timeout-minutes: 5

steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: pages-docs-html
path: ./

- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: pages-example-html
path: ./example
Expand All @@ -136,7 +126,7 @@ jobs:
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- uses: actions/upload-pages-artifact@v2
- uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: ./
Expand All @@ -158,4 +148,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Project specific files
package-lock.json
pnpm-lock.yaml
/node_modules
.github/**/node_modules
dist/
Expand Down
Loading

0 comments on commit 86f847f

Please sign in to comment.