Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/ci.generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,12 @@ jobs:
- name: Get tag version
id: get_tag_version
run: 'echo "TAG_VERSION=${GITHUB_REF/refs\/tags\//}" >> "$GITHUB_OUTPUT"'
- name: Get plugin file checksum
id: get_plugin_file_checksum
run: 'echo "CHECKSUM=$(shasum -a 256 plugin.json | awk ''{print $1}'')" >> "$GITHUB_OUTPUT"'
- name: Update Config Schema Version
run: 'sed -i ''s/exec\/0.0.0/exec\/${{ steps.get_tag_version.outputs.TAG_VERSION }}/'' deployment/schema.json'
- name: Build npm packages
run: deno run -A scripts/create_npm_packages.ts
- name: Create release notes
run: 'deno run -A ./scripts/generate_release_notes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} ${{ steps.get_plugin_file_checksum.outputs.CHECKSUM }} > ${{ github.workspace }}-CHANGELOG.txt'
run: 'deno run -A ./scripts/generate_release_notes.ts ${{ steps.get_tag_version.outputs.TAG_VERSION }} > ${{ github.workspace }}-CHANGELOG.txt'
- name: Release
uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2.6.1
env:
Expand Down
28 changes: 12 additions & 16 deletions .github/workflows/ci.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ const matrix = defineMatrix({
// build and test through cargo-zigbuild for zigbuild targets so the test
// suite links (and runs) binaries the same way as the published ones
cargo: profile.zigbuildGlibc != null ? "cargo-zigbuild" : "cargo",
cargo_target: profile.zigbuildGlibc != null ? `${profile.target}.${profile.zigbuildGlibc}` : profile.target,
cargo_target: profile.zigbuildGlibc != null
? `${profile.target}.${profile.zigbuildGlibc}`
: profile.target,
})),
});

Expand Down Expand Up @@ -254,7 +256,8 @@ const buildJob = job("build", {
{
name: "Build (Debug)",
if: isNotCross.and(isNotMuslImage).and(isNotTag),
run: "${{matrix.config.cargo}} build --locked --all-targets --target ${{matrix.config.cargo_target}}",
run:
"${{matrix.config.cargo}} build --locked --all-targets --target ${{matrix.config.cargo_target}}",
},
{
name: "Check glibc requirement (Debug)",
Expand All @@ -264,7 +267,8 @@ const buildJob = job("build", {
{
name: "Build release",
if: isNotCross.and(isNotMuslImage).and(isTag),
run: "${{matrix.config.cargo}} build --locked --all-targets --target ${{matrix.config.cargo_target}} --release",
run:
"${{matrix.config.cargo}} build --locked --all-targets --target ${{matrix.config.cargo_target}} --release",
},
{
name: "Build cross (Debug)",
Expand Down Expand Up @@ -315,12 +319,14 @@ const buildJob = job("build", {
{
name: "Test (Debug)",
if: runTests.equals("true").and(isNotTag),
run: "${{matrix.config.cargo}} test --locked --target ${{matrix.config.cargo_target}} --all-features",
run:
"${{matrix.config.cargo}} test --locked --target ${{matrix.config.cargo_target}} --all-features",
},
{
name: "Test (Release)",
if: runTests.equals("true").and(isTag),
run: "${{matrix.config.cargo}} test --locked --target ${{matrix.config.cargo_target}} --all-features --release",
run:
"${{matrix.config.cargo}} test --locked --target ${{matrix.config.cargo_target}} --all-features --release",
},
{
// runs after the tests so this checks the exact binary that gets zipped,
Expand Down Expand Up @@ -349,13 +355,6 @@ const getTagVersion = step({
outputs: ["TAG_VERSION"],
});

const getPluginFileChecksum = step({
id: "get_plugin_file_checksum",
name: "Get plugin file checksum",
run: `echo "CHECKSUM=$(shasum -a 256 plugin.json | awk '{print $1}')" >> "$GITHUB_OUTPUT"`,
outputs: ["CHECKSUM"],
});

const draftReleaseJob = job("draft_release", {
name: "draft_release",
if: isTag,
Expand Down Expand Up @@ -386,22 +385,19 @@ const draftReleaseJob = job("draft_release", {
run: "deno run --allow-read=. --allow-write=. scripts/create_plugin_file.ts",
},
getTagVersion,
getPluginFileChecksum,
{
name: "Update Config Schema Version",
run:
`sed -i 's/exec\\/0.0.0/exec\\/${getTagVersion.outputs.TAG_VERSION}/' deployment/schema.json`,
},
{
// must run before "Create release notes" — the notes embed the main
// npm tarball's sha256 from npm-dist/publish-manifest.json.
name: "Build npm packages",
run: "deno run -A scripts/create_npm_packages.ts",
},
{
name: "Create release notes",
run:
`deno run -A ./scripts/generate_release_notes.ts ${getTagVersion.outputs.TAG_VERSION} ${getPluginFileChecksum.outputs.CHECKSUM} > \${{ github.workspace }}-CHANGELOG.txt`,
`deno run -A ./scripts/generate_release_notes.ts ${getTagVersion.outputs.TAG_VERSION} > \${{ github.workspace }}-CHANGELOG.txt`,
},
{
name: "Release",
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ This plugin executes CLI commands to format code via stdin (recommended) or via
1. Install [dprint](https://dprint.dev/install/)
2. `dprint init`
3. `dprint add exec`
- Or install from npm: `dprint add npm:@dprint/exec`

## Configuration

Expand Down
10 changes: 5 additions & 5 deletions dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"**/*-lock.json"
],
"plugins": [
"https://plugins.dprint.dev/json-0.22.0.wasm",
"https://plugins.dprint.dev/markdown-0.22.1.wasm",
"https://plugins.dprint.dev/toml-0.7.0.wasm",
"https://plugins.dprint.dev/exec-0.7.0.json@4c1dc4bede760d7d40bafbafd886395013af597984c0ec4214232b4c4cd600ff",
"https://plugins.dprint.dev/typescript-0.96.1.wasm"
"npm:@dprint/json@0.23.0",
"npm:@dprint/markdown@0.22.1",
"npm:@dprint/toml@0.8.0",
"npm:@dprint/exec@0.7.3/plugin.json@704701df449dd7e942a71144773778ac529d68c2e4657bfc236d393b898b9a67",
"npm:@dprint/typescript@0.96.1"
]
}
37 changes: 2 additions & 35 deletions scripts/generate_release_notes.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,6 @@
import { generateChangeLog } from "jsr:@dprint/automation@0.11.2";

const version = Deno.args[0];
const checksum = Deno.args[1];

// optional npm install block; only emitted if create_npm_packages.ts has
// run and produced a manifest with the main package's tarball checksum.
let npmBlock = "";
try {
const manifest = JSON.parse(await Deno.readTextFile("npm-dist/publish-manifest.json")) as {
mainPackageName: string;
mainPackageChecksum: string;
};
npmBlock = `
Alternatively, run \`dprint add npm:${manifest.mainPackageName}\`, which will update the config file as follows:
\`\`\`jsonc
{
// etc...
"plugins": [
"npm:${manifest.mainPackageName}@${version}/plugin.json@${manifest.mainPackageChecksum}"
]
}
\`\`\`
`;
} catch (err) {
if (!(err instanceof Deno.errors.NotFound)) throw err;
}

const changelog = await generateChangeLog({
versionTo: version,
});
Expand All @@ -42,16 +17,8 @@ Dependencies:

Then:

1. Run \`dprint add exec\`, which will update the config file as follows:
\`\`\`jsonc
{
// etc...
"plugins": [
"https://plugins.dprint.dev/exec-${version}.json@${checksum}"
]
}
\`\`\`
${npmBlock}2. Follow the configuration setup instructions found at https://github.com/dprint/dprint-plugin-exec#configuration
1. Run \`dprint add exec\`, which will add the plugin to your dprint configuration file.
2. Follow the configuration setup instructions found at https://github.com/dprint/dprint-plugin-exec#configuration
`;

console.log(text);
Loading