diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e1f50a8 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,49 @@ +name: Build + +on: + push: + branches: + - "main" + tags: + - '[0-9]+.[0-9]+.[0-9]+' + pull_request: + branches: + - "main" + +jobs: + build: + name: Build & Publish + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v3.2.1 + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v3.2.1 + with: + useConfigFile: true + configFilePath: GitVersion.yml + + - name: Install NPM Packages + shell: pwsh + run: npm i + + - name: Build Project + shell: pwsh + run: npm run build + + - name: Publish to NPM + if: startsWith(github.ref, 'refs/tags/') + shell: pwsh + run: | + npm version ${{ steps.gitversion.outputs.fullSemVer }} --no-git-tag-version + npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/GitVersion.yml b/GitVersion.yml new file mode 100644 index 0000000..7a738f1 --- /dev/null +++ b/GitVersion.yml @@ -0,0 +1,28 @@ +mode: ContinuousDelivery +branches: + main: + label: beta + increment: Minor + regex: ^main$ + is-main-branch: true + source-branches: [] + pull-request: + label: alpha + increment: Minor + feature: + label: alpha + increment: Minor + regex: ^feature/? + is-main-branch: false + source-branches: + - main + hotfix: + label: alpha + increment: Patch + regex: ^(?:hot)?fix/? + is-main-branch: false + source-branches: + - main +ignore: + sha: [] +merge-message-formats: {} diff --git a/README.md b/README.md index ba8a6e0..e1379d7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Flexsaber +[![Build](https://github.com/mikeleg/flexsaber/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/mikeleg/flexsaber/actions?query=workflow%3A%22Build%22) ![Flexsaber Logo](./logo.png)