-
Notifications
You must be signed in to change notification settings - Fork 0
Added deploy workflow #4
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| name: Deploy | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: [Test] | ||
| types: [completed] | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| id-token: write | ||
| contents: write | ||
|
|
||
| jobs: | ||
| publish-npm: | ||
| name: Publish to NPM | ||
| runs-on: ubuntu-latest | ||
| environment: production | ||
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ github.event.workflow_run.head_sha }} | ||
|
|
||
| - name: Set up Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version-file: .nvmrc | ||
| cache: npm | ||
|
|
||
| - name: Install dependencies | ||
| run: npm --color ci | ||
|
|
||
| - name: Build | ||
| run: npm --color run build | ||
|
|
||
| - name: Read version from package.json | ||
| run: | | ||
| VERSION=$(node -p "require('./package.json').version") | ||
| echo "version=v$VERSION" >> $GITHUB_ENV | ||
|
|
||
| - name: Check whether this version is already published | ||
| run: | | ||
| if git ls-remote --exit-code --tags origin "refs/tags/${{ env.version }}" > /dev/null; then | ||
| echo "Version ${{ env.version }} is already tagged." | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Publish to NPM | ||
| run: npx -y npm@11.6.2 publish --access public | ||
|
|
||
| - name: Create Git tag | ||
| run: | | ||
| git tag ${{ env.version }} | ||
| git push origin ${{ env.version }} | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.