Update release workflow

This commit is contained in:
bjoluc 2021-10-03 15:03:13 +02:00
parent b3b1d14dd8
commit da654079f0
3 changed files with 10 additions and 13 deletions

View File

@ -19,9 +19,6 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Setup Node.js 16.x - name: Setup Node.js 16.x
uses: actions/setup-node@v2 uses: actions/setup-node@v2
@ -36,7 +33,8 @@ jobs:
env: env:
NODE_OPTIONS: "--max-old-space-size=4096" # Increase heap size for jest NODE_OPTIONS: "--max-old-space-size=4096" # Increase heap size for jest
- name: Create Release Pull Request - name: Create Release Pull Request or Publish Packages
id: changesets
uses: changesets/action@master uses: changesets/action@master
with: with:
publish: npm run release publish: npm run release
@ -60,6 +58,7 @@ jobs:
for (const { name: tag, version } of publishedPackages) { for (const { name: tag, version } of publishedPackages) {
// Only upload the dist archive for the chore package, plugins, and extensions // Only upload the dist archive for the chore package, plugins, and extensions
if (tag.startsWith("jspsych@") || tag.includes("/plugin-") || tag.includes("/extension-")) { if (tag.startsWith("jspsych@") || tag.includes("/plugin-") || tag.includes("/extension-")) {
console.log(`Uploading dist archive release asset for ${tag}`);
try { try {
// https://docs.github.com/en/rest/reference/repos#get-a-release-by-tag-name // https://docs.github.com/en/rest/reference/repos#get-a-release-by-tag-name
const releaseId = ( const releaseId = (
@ -79,11 +78,7 @@ jobs:
// Tag to filename transformation: // Tag to filename transformation:
// * jspsych@1.2.3 => jspsych-1.2.3-dist.zip // * jspsych@1.2.3 => jspsych-1.2.3-dist.zip
// * @jspsych/plugin-test@1.2.3 => jspsych-plugin-test-1.2.3-dist.zip // * @jspsych/plugin-test@1.2.3 => jspsych-plugin-test-1.2.3-dist.zip
// * @jspsych-contrib/plugin-test@1.2.3 => jspsych-contrib-plugin-test-1.2.3-dist.zip name: `${tag.replace("@jspsych/", "jspsych-").replace("@", "-")}-dist.zip`,
name: `${tag
.replace("@jspsych/", "jspsych-")
.replace("@jspsych-contrib/", "jspsych-contrib-")
.replace("@", "-")}-dist.zip`,
label: "Dist archive (zip)", label: "Dist archive (zip)",
headers: { headers: {
@ -101,4 +96,6 @@ jobs:
if (errorMessage) { if (errorMessage) {
core.setFailed(errorMessage); core.setFailed(errorMessage);
} else {
console.log(`Release assets successfully uploaded`);
} }

4
package-lock.json generated
View File

@ -8,8 +8,8 @@
"packages/*" "packages/*"
], ],
"devDependencies": { "devDependencies": {
"@changesets/changelog-github": "^0.4.0", "@changesets/changelog-github": "^0.4.1",
"@changesets/cli": "^2.16.0", "@changesets/cli": "^2.17.0",
"husky": "^7.0.1", "husky": "^7.0.1",
"import-sort-style-module": "^6.0.0", "import-sort-style-module": "^6.0.0",
"lint-staged": "^11.1.2", "lint-staged": "^11.1.2",

View File

@ -19,8 +19,8 @@
"npm": ">=7.0.0" "npm": ">=7.0.0"
}, },
"devDependencies": { "devDependencies": {
"@changesets/changelog-github": "^0.4.0", "@changesets/changelog-github": "^0.4.1",
"@changesets/cli": "^2.16.0", "@changesets/cli": "^2.17.0",
"husky": "^7.0.1", "husky": "^7.0.1",
"import-sort-style-module": "^6.0.0", "import-sort-style-module": "^6.0.0",
"lint-staged": "^11.1.2", "lint-staged": "^11.1.2",