From cf11b792cd85df9713cb94629b87ca7f9d57408d Mon Sep 17 00:00:00 2001 From: socialcode-rob1 Date: Tue, 1 Oct 2024 15:46:22 -0400 Subject: [PATCH] chore: update scripts --- .github/workflows/ci.yml | 84 ++++----------------------- .github/workflows/release-package.yml | 33 +++++++++++ .npmrc | 2 +- package.json | 2 +- 4 files changed, 47 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/release-package.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85b9a26..b13d7be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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: . @@ -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 }} @@ -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 }} @@ -161,13 +101,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 }} @@ -175,7 +115,7 @@ jobs: # run: yarn test --coverage # - name: Upload coverage -# uses: actions/upload-artifact@v3 +# uses: actions/upload-artifact@v4 # with: # name: coverage # path: coverage @@ -189,7 +129,7 @@ jobs: steps: - name: Download workspace - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: workspace path: . diff --git a/.github/workflows/release-package.yml b/.github/workflows/release-package.yml new file mode 100644 index 0000000..2c56d69 --- /dev/null +++ b/.github/workflows/release-package.yml @@ -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}} \ No newline at end of file diff --git a/.npmrc b/.npmrc index f1ec846..db699e6 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -registry=https://npm.pkg.github.com/socialcode-rob1 \ No newline at end of file +@socialcode-rob1:registry=https://npm.pkg.github.com \ No newline at end of file diff --git a/package.json b/package.json index a29229d..5eca2b1 100644 --- a/package.json +++ b/package.json @@ -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": {