From f86891e771fe4c389783cd287aa986491d5491b5 Mon Sep 17 00:00:00 2001 From: Luke Morales Date: Fri, 2 Feb 2024 10:05:43 -0300 Subject: [PATCH] ci: adjustments to `gpm` release pipeline --- .github/workflows/release.yml | 39 +++++++++++++++++------------------ 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 197e6ea..c6cfb71 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,7 @@ on: workflow_dispatch: inputs: force_github_package_release: - description: Force GPR release + description: Force GPM release type: boolean required: false default: false @@ -97,9 +97,9 @@ jobs: key: ${{ runner.os }}-build-${{ hashFiles('**/bun.lockb') }} - name: 🛠️ Setup Node for NPM - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: latest + node-version: '20.x' check-latest: true registry-url: 'https://registry.npmjs.org' @@ -122,14 +122,14 @@ jobs: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - gpr-release: + gpm-release: name: 🚀 Release to GitHub Package Manager if: ${{ github.event.inputs.force_github_package_release != 'true' || needs.release.outputs.published == 'true' }} runs-on: ubuntu-latest - needs: [build, release] + needs: [build] permissions: - contents: read packages: write + contents: read steps: - name: 🔑 Checkout Repository uses: actions/checkout@v4 @@ -145,27 +145,26 @@ jobs: path: "**/node_modules" key: ${{ runner.os }}-node-${{ hashFiles('**/bun.lockb') }} - - name: 🛠️ Setup Node for GPR - uses: actions/setup-node@v3 + - name: ♻️ Load build files + uses: actions/cache@v4 with: - node-version: latest + path: "**/dist" + key: ${{ runner.os }}-build-${{ hashFiles('**/bun.lockb') }} + + - name: 🛠️ Setup Node for GPM + uses: actions/setup-node@v4 + with: + node-version: '20.x' check-latest: true registry-url: 'https://npm.pkg.github.com' - - name: 👤 Set git user - run: | - git config --global user.email "lukemorales@live.com" - git config --global user.name "Luke Morales" - - name: 📦 Install dependencies if: steps.bun-cache.outputs.cache-hit != 'true' run: bun install --frozen-lockfile - - name: ⚒️ Build package - run: bun run build - - - name: 🚀 Publish to GPR - run: npm publish + - name: 🚀 Publish to GPM + run: | + echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> .npmrc + npm publish env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }}