Skip to content

Commit

Permalink
Add content from Lucas's personal repo
Browse files Browse the repository at this point in the history
  • Loading branch information
hubwriter committed Apr 12, 2024
1 parent 606f2e3 commit e03b530
Show file tree
Hide file tree
Showing 11 changed files with 1,730 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
needs_fr:
- '**' # index.php | src/main.php
- '.*' # .gitignore
- '.*/**' # .github/workflows/label.yml
38 changes: 38 additions & 0 deletions .github/workflows/caching.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Caching with npm

on: workflow_dispatch

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit == false }}
name: List the state of node modules
continue-on-error: true
run: npm list

- name: Install Dependencies
run: npm install

- name: Build
run: echo npm build

- name: Test
run: npm test
39 changes: 39 additions & 0 deletions .github/workflows/node_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16.x, 18.x]

name: Build using ${{ matrix.node-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm test

label_pr:
name: Label pull request for review
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@main
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
27 changes: 27 additions & 0 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Node.js Package
on:
release:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v2
with:
node-version: '10.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install
# Publish to npm
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v2
with:
registry-url: 'https://npm.pkg.github.com'
# Publish to GitHub Packages
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# onboarding-actions
This repository is used in the Docs team onboarding course for Actions.
# node-hello2
Everything is awesome node demo 🎉

Make a change, for a test.
12 changes: 12 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const http = require('http');
const express = require('express');

const hostname = '127.0.0.1';
const port = 3000;

var app = express();
app.use(express.static(__dirname + '/public'));

app.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
Loading

0 comments on commit e03b530

Please sign in to comment.