Skip to content

Commit

Permalink
feature/deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
choewy committed Mar 18, 2024
1 parent 75b81d0 commit cb13fd1
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 68 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: publish

on:
push:
branches: [master]
paths: ['package.json']

jobs:
diff:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.version.outputs }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- id: version
run: |
previous=$(git show HEAD^:package.json | grep '"version"' | awk -F '"' '{print $4}')
current=$(git show HEAD:package.json | grep '"version"' | awk -F '"' '{print $4}')
echo "previous=v$previous" >> $GITHUB_OUTPUT
echo "current=v$current" >> $GITHUB_OUTPUT
create-tag:
needs: diff
runs-on: ubuntu-22.04
outputs:
tag: ${{ steps.tag.outputs }}
if: needs.diff.outputs.version.previous != needs.diff.outputs.version.current
steps:
- uses: actions/checkout@v4
- name: create tag
id: tag
run: |
tag=${{ needs.diff.outputs.version.current }}
git tag $tag
git push origin $tag
echo "tag=$tag" >> $GITHUB_OUTPUT
create-release:
needs: create-tag
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.create-tag.outputs.tag }}
release_name: ${{ needs.create-tag.outputs.tag }}
draft: false
prerelease: false

npm-publish:
needs: create-release
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
- name: publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm ci
npm run build
npm publish
21 changes: 0 additions & 21 deletions .github/workflows/npm.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/release.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/version.yaml

This file was deleted.

0 comments on commit cb13fd1

Please sign in to comment.