-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
95 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
name: Dependabot auto-merge | ||
name: Dependabot Auto Merge | ||
|
||
on: pull_request | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
dependabot-auto-merge: | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Dependabot metadata | ||
- name: Dependabot Metadata | ||
id: metadata | ||
uses: dependabot/fetch-metadata@v1 | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
- name: Enable auto-merge for Dependabot PRs | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Enable Auto Merge for Dependabot PRs | ||
if: ${{steps.metadata.outputs.dependency-group == 'minor-and-patch-updates'}} | ||
run: gh pr merge --auto --rebase "$PR_URL" | ||
run: gh pr merge --auto --rebase $PR_URL | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
- name: Dispatch event | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
event-type: dependabot-merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,29 +2,25 @@ name: Release | |
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
mode: | ||
description: "Release mode" | ||
required: true | ||
default: "no publish" | ||
type: choice | ||
options: | ||
- "no publish" | ||
- "publish" | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
packages: write | ||
|
||
env: | ||
NPM_CONFIG_PROVENANCE: true | ||
|
||
concurrency: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
if: ${{ github.repository != 'Sec-ant/vanilla-ts' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
env: | ||
NPM_CONFIG_PROVENANCE: true | ||
steps: | ||
- name: Checkout Repo | ||
uses: actions/checkout@v4 | ||
|
@@ -37,33 +33,64 @@ jobs: | |
- name: Install Dependencies | ||
run: npm ci | ||
|
||
- name: Get Package Version | ||
id: package-version | ||
uses: martinbeentjes/[email protected] | ||
- name: Get Commit ID | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
id: get-commit-id | ||
run: | | ||
echo "short-commit-id=$(git rev-parse --short $GITHUB_SHA)" >> $GITHUB_OUTPUT | ||
echo "commit-id=$(git rev-parse $GITHUB_SHA)" >> $GITHUB_OUTPUT | ||
- name: Get Package Name | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
id: get-package-name | ||
run: echo "package-name=$(npm pkg get name | jq -r)" >> $GITHUB_OUTPUT | ||
|
||
- name: No Publish Build and Pack | ||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.mode == 'no publish' }} | ||
- name: Get Normalized Package Name | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
id: get-normalized-package-name | ||
uses: frabert/replace-string-action@v2 | ||
with: | ||
pattern: "^.*?([^/]+)$" | ||
string: ${{ steps.get-package-name.outputs.package-name }} | ||
replace-with: "$1" | ||
|
||
- name: Patch package.json | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
run: npm pkg set version=${{ steps.get-commit-id.outputs.short-commit-id }} | ||
|
||
- name: Build and Pack | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
run: | | ||
npm run build | ||
npm run prepublishOnly | ||
npm pack | ||
- name: No Publish Artifact Upload | ||
if: ${{ github.event_name == 'workflow_dispatch' && inputs.mode == 'no publish' }} | ||
uses: actions/upload-artifact@v4 | ||
- name: Draft Release | ||
if: ${{ github.event_name == 'workflow_dispatch' }} | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: package-artifact | ||
path: prettier-plugin-embed-${{steps.package-version.outputs.current-version}}.tgz | ||
retention-days: 1 | ||
overwrite: true | ||
allowUpdates: true | ||
artifacts: "${{ steps.get-normalized-package-name.outputs.replaced }}-${{ steps.get-commit-id.outputs.short-commit-id }}.tgz" | ||
artifactContentType: application/gzip | ||
body: "This is a draft release of ${{ steps.get-package-name.outputs.package-name }}: ${{ steps.get-commit-id.outputs.short-commit-id }}." | ||
commit: ${{ steps.get-commit-id.outputs.commit-id }} | ||
tag: "draft" | ||
draft: true | ||
name: "draft" | ||
removeArtifacts: true | ||
|
||
- name: Get Next Package Version | ||
if: ${{ github.event_name != 'workflow_dispatch' }} | ||
id: package-version | ||
run: echo "version=$(npx changeset status --output=release.json && jq -r '.releases[0].newVersion // '$(npm pkg get version)'' release.json && rm release.json)" >> $GITHUB_OUTPUT | ||
|
||
- name: Create Release Pull Request or Publish to npm | ||
if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.mode == 'publish') }} | ||
- name: Create Release Pull Request or Publish to NPM | ||
if: ${{ github.event_name != 'workflow_dispatch' }} | ||
id: changesets | ||
uses: changesets/action@v1 | ||
with: | ||
version: npm run bump | ||
publish: npx changeset publish | ||
commit: "chore(release): v${{steps.package-version.outputs.current-version}}" | ||
commit: "chore(release): v${{ steps.package-version.outputs.version }}" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [ | ||
"*.{js,ts,cjs,mjs,cts,mts,d.cts,d.mts,jsx,tsx,json,jsonc}": [ | ||
"biome check --apply --no-errors-on-unmatched --files-ignore-unknown=true" | ||
], | ||
"*.md": ["prettier --write --no-config"] | ||
"*.{md,yml,yaml,css,html}": ["prettier --write"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
*.js | ||
*.ts | ||
*.cjs | ||
*.mjs | ||
*.cts | ||
*.mts | ||
*.d.cts | ||
*.d.mts | ||
*.jsx | ||
*.tsx | ||
*.json | ||
*.jsonc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters