Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update scripts #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 12 additions & 72 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,6 @@ on:
branches:
- master

jobs:
install-dependencies:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Restore workspace cache
uses: actions/cache@v3
with:
path: |
node_modules
example/node_modules
key: dependencies-${{ runner.os }}-${{ hashFiles('package.json') }}
restore-keys: |
dependencies-${{ runner.os }}-

- name: Install dependencies (example)
run: yarn install --cwd example --frozen-lockfile

- name: Install dependencies (root)
run: yarn install --frozen-lockfile

- name: Save workspace
uses: actions/upload-artifact@v3
with:
name: workspace
path: .


Here’s how you can convert the provided CircleCI configuration to a GitHub Actions workflow while ensuring that the build script uses Node.js 18.

Key Changes:
Node.js Version: Updated to use Node.js 18.
Caching: GitHub Actions uses actions/cache for caching dependencies.
Workspace Management: Instead of attach_workspace, the workspace management is handled natively by GitHub Actions.
GitHub Actions Workflow (.github/workflows/ci.yml)
yaml
Copy code
name: Build and Test

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
install-dependencies:
runs-on: ubuntu-latest
Expand All @@ -78,16 +18,16 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Restore workspace cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
node_modules
Expand All @@ -103,7 +43,7 @@ jobs:
run: yarn install --frozen-lockfile

- name: Save workspace
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: workspace
path: .
Expand All @@ -117,13 +57,13 @@ jobs:

steps:
- name: Download workspace
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: workspace
path: .

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -139,13 +79,13 @@ jobs:

steps:
- name: Download workspace
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: workspace
path: .

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -161,21 +101,21 @@ jobs:

# steps:
# - name: Download workspace
# uses: actions/download-artifact@v3
# uses: actions/download-artifact@v4
# with:
# name: workspace
# path: .

# - name: Set up Node.js
# uses: actions/setup-node@v3
# uses: actions/setup-node@v4
# with:
# node-version: ${{ matrix.node-version }}

# - name: Run unit tests
# run: yarn test --coverage

# - name: Upload coverage
# uses: actions/upload-artifact@v3
# uses: actions/upload-artifact@v4
# with:
# name: coverage
# path: coverage
Expand All @@ -189,7 +129,7 @@ jobs:

steps:
- name: Download workspace
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: workspace
path: .
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/release-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: [18.x]
- run: npm ci
- run: npm test

publish-gpr:
needs: build
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: [18.x]
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
registry=https://npm.pkg.github.com/socialcode-rob1
@socialcode-rob1:registry=https://npm.pkg.github.com
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"homepage": "https://github.com/socialcode-rob1/react-native-jitsimeet-custom#readme",
"publishConfig": {
"registry": "https://npm.pkg.github.com/socialcode-rob1",
"@socialcode-rob1:registry": "https://npm.pkg.github.com",
"access": "public"
},
"devDependencies": {
Expand Down
Loading