Skip to content
Closed
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
74 changes: 72 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ on:
branches:
- master

env:
pnpm_config_dangerously_allow_all_builds: true
permissions: {}

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -36,3 +37,72 @@ jobs:
# uses: coverallsapp/github-action@main
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}

release:
name: Release
if: github.event_name == 'push'
needs: [test]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
Comment thread
coderabbitai[bot] marked this conversation as resolved.
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: https://registry.npmjs.org
- name: Check published artifacts
id: version
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

if npm view "@kikobeats/cacheable-request@$VERSION" version > /dev/null 2>&1; then
echo "@kikobeats/cacheable-request@$VERSION is already published"
else
echo "publish=true" >> "$GITHUB_OUTPUT"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
fi

if git ls-remote --exit-code origin "refs/tags/v$VERSION" > /dev/null 2>&1; then
echo "tag v$VERSION already exists"
else
echo "tag=true" >> "$GITHUB_OUTPUT"
fi

if gh release view "v$VERSION" > /dev/null 2>&1; then
echo "GitHub release v$VERSION already exists"
else
echo "release=true" >> "$GITHUB_OUTPUT"
fi
- name: Setup PNPM
if: steps.version.outputs.publish == 'true'
uses: pnpm/action-setup@v4
with:
version: latest
run_install: true
- name: Publish
if: steps.version.outputs.publish == 'true'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access=public
- name: Tag
if: steps.version.outputs.tag == 'true'
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.version }}
run: |
gh auth setup-git
git tag "v$VERSION"
git push origin "v$VERSION"
- name: GitHub release
if: steps.version.outputs.release == 'true'
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.version.outputs.version }}
run: gh release create "v$VERSION" --title "v$VERSION" --generate-notes
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@kikobeats/cacheable-request",
"description": "Wrap native HTTP requests with RFC compliant cache support",
"homepage": "https://github.com/@kikobeats/cacheable-request#readme",
"version": "7.0.6",
"version": "7.0.7",
"main": "src/index.js",
"author": {
"email": "josefrancisco.verdu@gmail.com",
Expand Down
4 changes: 4 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
allowBuilds:
'@parcel/watcher': true
esbuild: true
unrs-resolver: true
Loading