Skip to content

Commit

Permalink
Proof of concept for release action
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Aug 14, 2024
1 parent b093768 commit c630c42
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ npm ci
npm test
npm version patch
git push --follow-tags
```

The action will run and publish the package for you, in case that fails try:

```sh
cd npmDist && npm publish
npm run changelog
```
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: publish-npm
on:
push:
tags:
- v17.*.*

permissions: {}
jobs:
build-npm-dist:
runs-on: ubuntu-latest
permissions:
contents: read # for actions/checkout
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: '.node-version'

- name: Install Dependencies
run: npm ci --ignore-scripts

- name: Build NPM package
run: npm run build:npm

- name: Upload npmDist package
uses: actions/upload-artifact@v4
with:
name: npmDist
path: ./npmDist

publish-release:
runs-on: ubuntu-latest
name: Publish Release
environment: release-npm
needs: [build-npm-dist]
permissions:
contents: read # for actions/checkout
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version-file: '.node-version'
# 'registry-url' is required for 'npm publish'
registry-url: 'https://registry.npmjs.org'

- uses: actions/download-artifact@v4
with:
name: npmDist
path: npmDist

- name: Publish NPM package
run: npm publish --ignore-scripts ./npmDist
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_canary_pr_publish_token }}


- name: Create CHANGELOG.txt
run: npm run changelog > CHANGELOG.txt
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ./CHANGELOG.txt
repository: graphql/graphql-js
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
make_latest: false

0 comments on commit c630c42

Please sign in to comment.