diff --git a/.github/workflows/npmjs-publish.yml b/.github/workflows/npmjs-publish.yml new file mode 100644 index 00000000..7e34866d --- /dev/null +++ b/.github/workflows/npmjs-publish.yml @@ -0,0 +1,44 @@ +name: Build and Upload Package + +on: + release: + types: [published] + workflow_dispatch: + inputs: + version: + description: 'What version to use for the release' + required: true + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Set release version + run: | + tag="${{ github.event.inputs.version }}" + if [ -z "$tag" ]; then + tag="${GITHUB_REF_NAME}" + fi + version="${tag#v}" # Strip leading v + + # Bump library tag + npm version --no-git-tag-version "$version" + + git config user.name 'GitHub Actions' + git config user.email eng+github@repl.it + + git commit -m 'Setting version' package.json + + - name: Build and publish + run: | + npm set "//registry.npmjs.org/:_authToken" "${{ secrets.NPMJS_AUTH_TOKEN }}" + npm install --frozen-lockfile + npm run publish diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..017ce454 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,33 @@ +name: Release Drafter + +on: + workflow_dispatch: {} + push: + # branches to consider in the event; optional, defaults to all + branches: + - main + # pull_request event is required only for autolabeler + pull_request: + # Only following types are handled by the action, but one can default to all as well + types: [opened, reopened, synchronize] + # pull_request_target event is required for autolabeler to support PRs from forks + pull_request_target: + types: [opened, reopened, synchronize] + +permissions: + contents: read + +jobs: + update_release_draft: + permissions: + # write permission is required to create a github release + contents: write + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: write + runs-on: ubuntu-latest + steps: + # Drafts your next Release notes as Pull Requests are merged into "master" + - uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}