mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-30 02:47:22 +02:00
Merge pull request #18350 from timvandermeij/github-actions-release
Introduce a GitHub Actions workflow for publishing a release and fix `npm publish` warnings about the `package.json` format
This commit is contained in:
commit
b5d554e1b4
38
.github/workflows/publish_release.yml
vendored
Normal file
38
.github/workflows/publish_release.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
name: Publish release
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: Publish
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node-version: [lts/*]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: ${{ matrix.node-version }}
|
||||||
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Build the `pdfjs-dist` library
|
||||||
|
run: npx gulp dist
|
||||||
|
|
||||||
|
- name: Publish the `pdfjs-dist` library to NPM
|
||||||
|
run: npm publish ./build/dist
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
48
gulpfile.mjs
48
gulpfile.mjs
@ -2226,11 +2226,12 @@ function packageJson() {
|
|||||||
},
|
},
|
||||||
repository: {
|
repository: {
|
||||||
type: "git",
|
type: "git",
|
||||||
url: DIST_REPO_URL,
|
url: `git+${DIST_REPO_URL}.git`,
|
||||||
},
|
},
|
||||||
engines: {
|
engines: {
|
||||||
node: ">=18",
|
node: ">=18",
|
||||||
},
|
},
|
||||||
|
scripts: {},
|
||||||
};
|
};
|
||||||
|
|
||||||
return createStringSource(
|
return createStringSource(
|
||||||
@ -2240,7 +2241,7 @@ function packageJson() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"dist-pre",
|
"dist",
|
||||||
gulp.series(
|
gulp.series(
|
||||||
"generic",
|
"generic",
|
||||||
"generic-legacy",
|
"generic-legacy",
|
||||||
@ -2368,7 +2369,7 @@ gulp.task(
|
|||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"dist-install",
|
"dist-install",
|
||||||
gulp.series("dist-pre", function createDistInstall(done) {
|
gulp.series("dist", function createDistInstall(done) {
|
||||||
let distPath = DIST_DIR;
|
let distPath = DIST_DIR;
|
||||||
const opts = {};
|
const opts = {};
|
||||||
const installPath = process.env.PDFJS_INSTALL_PATH;
|
const installPath = process.env.PDFJS_INSTALL_PATH;
|
||||||
@ -2381,47 +2382,6 @@ gulp.task(
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
|
||||||
"dist",
|
|
||||||
gulp.series("dist-pre", function createDist(done) {
|
|
||||||
const VERSION = getVersionJSON().version;
|
|
||||||
|
|
||||||
console.log();
|
|
||||||
console.log("### Committing changes");
|
|
||||||
|
|
||||||
let reason = process.env.PDFJS_UPDATE_REASON;
|
|
||||||
// Attempt to work-around the broken link, see https://github.com/mozilla/pdf.js/issues/10391
|
|
||||||
if (typeof reason === "string") {
|
|
||||||
const reasonParts =
|
|
||||||
/^(See )(mozilla\/pdf\.js)@tags\/(v\d+\.\d+\.\d+)\s*$/.exec(reason);
|
|
||||||
|
|
||||||
if (reasonParts) {
|
|
||||||
reason =
|
|
||||||
reasonParts[1] +
|
|
||||||
"https://github.com/" +
|
|
||||||
reasonParts[2] +
|
|
||||||
"/releases/tag/" +
|
|
||||||
reasonParts[3];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const message =
|
|
||||||
"PDF.js version " + VERSION + (reason ? " - " + reason : "");
|
|
||||||
safeSpawnSync("git", ["add", "*"], { cwd: DIST_DIR });
|
|
||||||
safeSpawnSync("git", ["commit", "-am", message], { cwd: DIST_DIR });
|
|
||||||
safeSpawnSync("git", ["tag", "-a", "v" + VERSION, "-m", message], {
|
|
||||||
cwd: DIST_DIR,
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log();
|
|
||||||
console.log("Done. Push with");
|
|
||||||
console.log(
|
|
||||||
" cd " + DIST_DIR + "; git push --tags " + DIST_REPO_URL + " master"
|
|
||||||
);
|
|
||||||
console.log();
|
|
||||||
done();
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"mozcentralbaseline",
|
"mozcentralbaseline",
|
||||||
gulp.series(createBaseline, function createMozcentralBaseline(done) {
|
gulp.series(createBaseline, function createMozcentralBaseline(done) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user