diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..da905aa --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,48 @@ +name: Create Tag and Publish Release + +on: + push: + branches: + - main + +permissions: + contents: write + repository-projects: write + deployments: write + packages: write + actions: write + +jobs: + version_and_release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "npm" + - name: Install dependencies + run: npm install + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + - name: Bump version + id: bump_version + run: | + NEW_VERSION=$(npm version patch -m "Bump version to %s") + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT + - name: Push changes + run: | + git push origin main + git push origin --tags + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + with: + tag_name: ${{ steps.bump_version.outputs.new_version }} + release_name: Release ${{ steps.bump_version.outputs.new_version }}