mirror of
https://github.com/softprops/action-gh-release.git
synced 2026-04-12 21:28:18 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b430933298 | ||
|
|
c2e35e05a7 |
3
.github/dependabot.yml
vendored
3
.github/dependabot.yml
vendored
@@ -12,9 +12,6 @@ updates:
|
|||||||
- dependency-name: node-fetch
|
- dependency-name: node-fetch
|
||||||
versions:
|
versions:
|
||||||
- ">=3.0.0"
|
- ">=3.0.0"
|
||||||
- dependency-name: "@types/node"
|
|
||||||
versions:
|
|
||||||
- ">=22.0.0"
|
|
||||||
commit-message:
|
commit-message:
|
||||||
prefix: "chore(deps)"
|
prefix: "chore(deps)"
|
||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
|
|||||||
44
.github/workflows/main.yml
vendored
44
.github/workflows/main.yml
vendored
@@ -4,6 +4,11 @@ on:
|
|||||||
push:
|
push:
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-24.04
|
runs-on: ubuntu-24.04
|
||||||
@@ -20,10 +25,49 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
- name: Check dist freshness
|
- name: Check dist freshness
|
||||||
|
id: dist_freshness
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
git diff --exit-code --stat -- dist/index.js \
|
git diff --exit-code --stat -- dist/index.js \
|
||||||
|| (echo "##[error] found changed dist/index.js after build. please run 'npm run build' and commit the updated bundle" \
|
|| (echo "##[error] found changed dist/index.js after build. please run 'npm run build' and commit the updated bundle" \
|
||||||
&& exit 1)
|
&& exit 1)
|
||||||
|
- name: Comment on stale dist bundle
|
||||||
|
if: github.event_name == 'pull_request' && steps.dist_freshness.outcome == 'failure'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
GH_REPO: ${{ github.repository }}
|
||||||
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
|
run: |
|
||||||
|
marker='<!-- dist-freshness-check -->'
|
||||||
|
diff_stat="$(git diff --stat -- dist/index.js)"
|
||||||
|
body=$(cat <<EOF
|
||||||
|
$marker
|
||||||
|
\`dist/index.js\` changed after \`npm run build\`.
|
||||||
|
|
||||||
|
Please run \`npm run build\` and commit the regenerated bundle.
|
||||||
|
|
||||||
|
\`\`\`text
|
||||||
|
$diff_stat
|
||||||
|
\`\`\`
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
existing_id="$(
|
||||||
|
gh api "repos/$GH_REPO/issues/$PR_NUMBER/comments" \
|
||||||
|
--jq '.[] | select(.user.login == "github-actions[bot]" and (.body | contains("<!-- dist-freshness-check -->"))) | .id' \
|
||||||
|
| tail -n 1
|
||||||
|
)"
|
||||||
|
|
||||||
|
if [ -n "$existing_id" ]; then
|
||||||
|
gh api --method PATCH "repos/$GH_REPO/issues/comments/$existing_id" -f body="$body" >/dev/null
|
||||||
|
else
|
||||||
|
gh api --method POST "repos/$GH_REPO/issues/$PR_NUMBER/comments" -f body="$body" >/dev/null
|
||||||
|
fi
|
||||||
|
- name: Fail on stale dist bundle
|
||||||
|
if: steps.dist_freshness.outcome == 'failure'
|
||||||
|
run: |
|
||||||
|
echo "##[error] found changed dist/index.js after build. please run 'npm run build' and commit the updated bundle"
|
||||||
|
exit 1
|
||||||
- name: Test
|
- name: Test
|
||||||
run: npm run test
|
run: npm run test
|
||||||
- name: Format
|
- name: Format
|
||||||
|
|||||||
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,3 +1,18 @@
|
|||||||
|
## 3.0.0
|
||||||
|
|
||||||
|
`3.0.0` is a major release that moves the action runtime from Node 20 to Node 24.
|
||||||
|
Use `v3` on GitHub-hosted runners and self-hosted fleets that already support the
|
||||||
|
Node 24 Actions runtime. If you still need the last Node 20-compatible line, stay on
|
||||||
|
`v2.6.2`.
|
||||||
|
|
||||||
|
## What's Changed
|
||||||
|
|
||||||
|
### Other Changes 🔄
|
||||||
|
|
||||||
|
* Move the action runtime and bundle target to Node 24
|
||||||
|
* Update `@types/node` to the Node 24 line and allow future Dependabot updates
|
||||||
|
* Keep the floating major tag on `v3`; `v2` remains pinned to the latest `2.x` release
|
||||||
|
|
||||||
## 2.6.2
|
## 2.6.2
|
||||||
|
|
||||||
## What's Changed
|
## What's Changed
|
||||||
|
|||||||
17
README.md
17
README.md
@@ -39,6 +39,9 @@ Typically usage of this action involves adding a step to a build that
|
|||||||
is gated pushes to git tags. You may find `step.if` field helpful in accomplishing this
|
is gated pushes to git tags. You may find `step.if` field helpful in accomplishing this
|
||||||
as it maximizes the reuse value of your workflow for non-tag pushes.
|
as it maximizes the reuse value of your workflow for non-tag pushes.
|
||||||
|
|
||||||
|
`v3` requires a GitHub Actions runtime that supports Node 24. If you still need the
|
||||||
|
last Node 20-compatible line, stay on `v2.6.2`.
|
||||||
|
|
||||||
Below is a simple example of `step.if` tag gating
|
Below is a simple example of `step.if` tag gating
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -53,7 +56,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v3
|
||||||
if: github.ref_type == 'tag'
|
if: github.ref_type == 'tag'
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -74,7 +77,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v3
|
||||||
```
|
```
|
||||||
|
|
||||||
### ⬆️ Uploading release assets
|
### ⬆️ Uploading release assets
|
||||||
@@ -105,7 +108,7 @@ jobs:
|
|||||||
- name: Test
|
- name: Test
|
||||||
run: cat Release.txt
|
run: cat Release.txt
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v3
|
||||||
if: github.ref_type == 'tag'
|
if: github.ref_type == 'tag'
|
||||||
with:
|
with:
|
||||||
files: Release.txt
|
files: Release.txt
|
||||||
@@ -129,7 +132,7 @@ jobs:
|
|||||||
- name: Test
|
- name: Test
|
||||||
run: cat Release.txt
|
run: cat Release.txt
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v3
|
||||||
if: github.ref_type == 'tag'
|
if: github.ref_type == 'tag'
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
@@ -146,7 +149,7 @@ and keep the `files` patterns relative to that directory.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v3
|
||||||
if: github.ref_type == 'tag'
|
if: github.ref_type == 'tag'
|
||||||
with:
|
with:
|
||||||
working_directory: dist
|
working_directory: dist
|
||||||
@@ -175,7 +178,7 @@ jobs:
|
|||||||
- name: Generate Changelog
|
- name: Generate Changelog
|
||||||
run: echo "# Good things have arrived" > ${{ github.workspace }}-CHANGELOG.txt
|
run: echo "# Good things have arrived" > ${{ github.workspace }}-CHANGELOG.txt
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v3
|
||||||
if: github.ref_type == 'tag'
|
if: github.ref_type == 'tag'
|
||||||
with:
|
with:
|
||||||
body_path: ${{ github.workspace }}-CHANGELOG.txt
|
body_path: ${{ github.workspace }}-CHANGELOG.txt
|
||||||
@@ -193,7 +196,7 @@ comparison range does not match the release series you want to publish.
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v3
|
||||||
with:
|
with:
|
||||||
tag_name: stage-2026-03-15
|
tag_name: stage-2026-03-15
|
||||||
target_commitish: ${{ github.sha }}
|
target_commitish: ${{ github.sha }}
|
||||||
|
|||||||
@@ -22,13 +22,14 @@ Use this checklist when cutting a new `action-gh-release` release.
|
|||||||
- `npm run build`
|
- `npm run build`
|
||||||
- `npm test`
|
- `npm test`
|
||||||
5. Commit the release prep.
|
5. Commit the release prep.
|
||||||
- Use a plain release commit message like `release 2.5.4`.
|
- Use a plain release commit message like `release 3.0.0`.
|
||||||
6. Create the annotated tag for the release commit.
|
6. Create the annotated tag for the release commit.
|
||||||
- Example: `git tag -a v2.5.4 -m "v2.5.4"`
|
- Example: `git tag -a v3.0.0 -m "v3.0.0"`
|
||||||
7. Push the commit and tag.
|
7. Push the commit and tag.
|
||||||
- Example: `git push origin master && git push origin v2.5.4`
|
- Example: `git push origin master && git push origin v3.0.0`
|
||||||
8. Move the floating major tag to the new release tag.
|
8. Move the floating major tag to the new release tag.
|
||||||
- For the current major line, either run `npm run updatetag` or update the script first if the major ever changes.
|
- For the current major line, run `npm run updatetag` to move `v3`.
|
||||||
|
- Keep `v2` pinned to the latest `2.x` release for consumers that still need the Node 20 runtime.
|
||||||
- Verify the floating tag points at the same commit as the new full tag.
|
- Verify the floating tag points at the same commit as the new full tag.
|
||||||
9. Create the GitHub release from the new tag.
|
9. Create the GitHub release from the new tag.
|
||||||
- Prefer the release body from [CHANGELOG.md](CHANGELOG.md), then let GitHub append generated notes only if they add value.
|
- Prefer the release body from [CHANGELOG.md](CHANGELOG.md), then let GitHub append generated notes only if they add value.
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ outputs:
|
|||||||
assets:
|
assets:
|
||||||
description: "JSON array containing information about each uploaded asset, in the format given [here](https://docs.github.com/en/rest/reference/repos#upload-a-release-asset--code-samples) (minus the `uploader` field)"
|
description: "JSON array containing information about each uploaded asset, in the format given [here](https://docs.github.com/en/rest/reference/repos#upload-a-release-asset--code-samples) (minus the `uploader` field)"
|
||||||
runs:
|
runs:
|
||||||
using: "node20"
|
using: "node24"
|
||||||
main: "dist/index.js"
|
main: "dist/index.js"
|
||||||
branding:
|
branding:
|
||||||
color: "green"
|
color: "green"
|
||||||
|
|||||||
38
dist/index.js
vendored
38
dist/index.js
vendored
File diff suppressed because one or more lines are too long
568
package-lock.json
generated
568
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "action-gh-release",
|
"name": "action-gh-release",
|
||||||
"version": "2.6.2",
|
"version": "3.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "GitHub Action for creating GitHub Releases",
|
"description": "GitHub Action for creating GitHub Releases",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "esbuild src/main.ts --bundle --platform=node --format=cjs --target=node20 --outfile=dist/index.js --minify",
|
"build": "esbuild src/main.ts --bundle --platform=node --format=cjs --target=node24 --outfile=dist/index.js --minify",
|
||||||
"build-debug": "esbuild src/main.ts --bundle --platform=node --format=cjs --target=node20 --outfile=dist/index.js --sourcemap --keep-names",
|
"build-debug": "esbuild src/main.ts --bundle --platform=node --format=cjs --target=node24 --outfile=dist/index.js --sourcemap --keep-names",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"test": "vitest --coverage",
|
"test": "vitest --coverage",
|
||||||
"fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
"fmt": "prettier --write \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
||||||
"fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
"fmtcheck": "prettier --check \"src/**/*.ts\" \"__tests__/**/*.ts\"",
|
||||||
"updatetag": "git tag -d v2 && git push origin :v2 && git tag -a v2 -m '' && git push origin v2"
|
"updatetag": "git tag -d v3 >/dev/null 2>&1 || true; git push origin :v3 >/dev/null 2>&1 || true; git tag -a v3 -m '' && git push origin v3"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -21,9 +21,12 @@
|
|||||||
"actions"
|
"actions"
|
||||||
],
|
],
|
||||||
"author": "softprops",
|
"author": "softprops",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=24"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^3.0.0",
|
"@actions/core": "^3.0.0",
|
||||||
"@actions/github": "^9.0.0",
|
"@actions/github": "^9.1.0",
|
||||||
"@octokit/plugin-retry": "^8.1.0",
|
"@octokit/plugin-retry": "^8.1.0",
|
||||||
"@octokit/plugin-throttling": "^11.0.3",
|
"@octokit/plugin-throttling": "^11.0.3",
|
||||||
"glob": "^13.0.6",
|
"glob": "^13.0.6",
|
||||||
@@ -32,12 +35,12 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/glob": "^9.0.0",
|
"@types/glob": "^9.0.0",
|
||||||
"@types/mime-types": "^3.0.1",
|
"@types/mime-types": "^3.0.1",
|
||||||
"@types/node": "^20.19.37",
|
"@types/node": "^24",
|
||||||
"@vitest/coverage-v8": "^4.1.0",
|
"@vitest/coverage-v8": "^4.1.4",
|
||||||
"esbuild": "^0.27.3",
|
"esbuild": "^0.28.0",
|
||||||
"prettier": "3.8.1",
|
"prettier": "3.8.2",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^6.0.2",
|
||||||
"typescript-formatter": "^7.2.2",
|
"typescript-formatter": "^7.2.2",
|
||||||
"vitest": "^4.0.4"
|
"vitest": "^4.0.4"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ export const upload = async (
|
|||||||
size,
|
size,
|
||||||
mime,
|
mime,
|
||||||
token: config.github_token,
|
token: config.github_token,
|
||||||
data: fh.readableWebStream({ type: 'bytes' }),
|
data: fh.readableWebStream(),
|
||||||
});
|
});
|
||||||
} finally {
|
} finally {
|
||||||
await fh.close();
|
await fh.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user