diff --git a/.github/workflows/automated-release.yaml b/.github/workflows/automated-release.yaml new file mode 100644 index 0000000..227cf25 --- /dev/null +++ b/.github/workflows/automated-release.yaml @@ -0,0 +1,52 @@ +name: Automated Release + +permissions: + id-token: write + contents: write + +on: + push: + branches: + - release + +jobs: + release: + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: pnpm/action-setup@v4 + with: + version: 9.15.0 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + registry-url: https://registry.npmjs.org/ + + - name: Install dependencies + run: pnpm install + + - name: Build the project + run: pnpm run build + + - name: Publish to npm + run: pnpm publish -r --access public --publish-branch release + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: true + + - name: Get version from package.json + id: get_version + run: | + VERSION=$(node -p "require('./package.json').version") + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Create Git Tag + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag -a "v${VERSION}" -m "Release v${VERSION}" + git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/KID-joker/npm-deprecated-check.git "v${VERSION}"