Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
softprops authored Mar 8, 2024
2 parents 282f350 + 762fe13 commit 0a9ebaf
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
steps:
# https://github.com/actions/checkout
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install
run: npm ci
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.13.1
20.11.1
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 2.0.1 (unreleased)

- Fail run if files setting contains invalid patterns [#384](https://github.com/softprops/action-gh-release/pull/384) via [@rpdelaney](https://github.com/rpdelaney)
- Add support for proxy env variables (don't use node-fetch) [#386](https://github.com/softprops/action-gh-release/pull/386/) via [@timor-raiman](https://github.com/timor-raiman)
- Suppress confusing warning when input_files is empty [#389](https://github.com/softprops/action-gh-release/pull/389) via [@Drowze](https://github.com/Drowze)

## 2.0.0

- `2.0.0`!? this release corrects a disjunction between git tag versions used in the marketplace and versions list this file. Previous versions should have really been 1.\*. Going forward this should be better aligned.
- Upgrade action.yml declaration to node20 to address deprecations

## 0.1.15

- Upgrade to action.yml declaration to node16 to address deprecations
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019 Doug Tangren
Copyright (c) 2019-current Doug Tangren

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
27 changes: 16 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
```
Expand All @@ -62,9 +62,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
```
### ⬆️ Uploading release assets
Expand All @@ -88,13 +88,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build
run: echo ${{ github.sha }} > Release.txt
- name: Test
run: cat Release.txt
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: Release.txt
Expand All @@ -112,21 +112,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build
run: echo ${{ github.sha }} > Release.txt
- name: Test
run: cat Release.txt
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
Release.txt
LICENSE
```

> **⚠️ Note:** Notice the `|` in the yaml syntax above ☝️. That let's you effectively declare a multi-line yaml string. You can learn more about multi-line yaml syntax [here](https://yaml-multiline.info)
> **⚠️ Note:** Notice the `|` in the yaml syntax above ☝️. That lets you effectively declare a multi-line yaml string. You can learn more about multi-line yaml syntax [here](https://yaml-multiline.info)

> **⚠️ Note for Windows:** Paths must use `/` as a separator, not `\`, as `\` is used to escape characters with special meaning in the pattern; for example, instead of specifying `D:\Foo.txt`, you must specify `D:/Foo.txt`. If you're using PowerShell, you can do this with `$Path = $Path -replace '\\','/'`

### 📝 External release notes

Expand All @@ -144,11 +146,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Generate Changelog
run: echo "# Good things have arrived" > ${{ github.workspace }}-CHANGELOG.txt
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: ${{ github.workspace }}-CHANGELOG.txt
Expand Down Expand Up @@ -233,4 +235,7 @@ permissions:

[GitHub token permissions](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token) can be set for an individual job, workflow, or for Actions as a whole.

Note that if you intend to run workflows on the release event (`on: { release: { types: [published] } }`), you need to use
a personal access token for this action, as the [default `secrets.GITHUB_TOKEN` does not trigger another workflow](https://github.com/actions/create-release/issues/71).

Doug Tangren (softprops) 2019
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ outputs:
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)"
runs:
using: "node16"
using: "node20"
main: "dist/index.js"
branding:
color: "green"
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
"@octokit/plugin-retry": "^4.0.3",
"@octokit/plugin-throttling": "^4.3.2",
"glob": "^8.0.3",
"mime": "^3.0.0",
"node-fetch": "^2.6.7"
"mime": "^3.0.0"
},
"devDependencies": {
"@types/glob": "^8.0.0",
"@types/jest": "^29.2.3",
"@types/mime": "^3.0.1",
"@types/node": "^18.11.9",
"@types/node-fetch": "^2.5.12",
"@vercel/ncc": "^0.34.0",
"jest": "^29.3.1",
"jest-circus": "^29.3.1",
Expand Down
17 changes: 0 additions & 17 deletions release.sh

This file was deleted.

10 changes: 5 additions & 5 deletions src/github.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fetch from "node-fetch";
import { GitHub } from "@actions/github/lib/utils";
import { Config, isTag, releaseBody } from "./util";
import { statSync, readFileSync } from "fs";
Expand Down Expand Up @@ -163,16 +162,17 @@ export const upload = async (
console.log(`⬆️ Uploading ${name}...`);
const endpoint = new URL(url);
endpoint.searchParams.append("name", name);
const resp = await fetch(endpoint, {
const resp = await github.request({
method: "POST",
url: endpoint.toString(),
headers: {
"content-length": `${size}`,
"content-type": mime,
authorization: `token ${config.github_token}`,
},
method: "POST",
body,
data: body,
});
const json = await resp.json();
const json = resp.data;
if (resp.status !== 201) {
throw new Error(
`Failed to upload release asset ${name}. received status code ${
Expand Down
10 changes: 5 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ async function run() {
}
if (config.input_files) {
const patterns = unmatchedPatterns(config.input_files);
patterns.forEach((pattern) =>
console.warn(`🤔 Pattern '${pattern}' does not match any files.`)
);
patterns.forEach((pattern) => {
throw new Error(`⚠️ Pattern '${pattern}' does not match any files.`);
});
if (patterns.length > 0 && config.input_fail_on_unmatched_files) {
throw new Error(`⚠️ There were unmatched files`);
}
Expand Down Expand Up @@ -60,10 +60,10 @@ async function run() {
});
//);
const rel = await release(config, new GitHubReleaser(gh));
if (config.input_files) {
if (config.input_files && config.input_files.length > 0) {
const files = paths(config.input_files);
if (files.length == 0) {
console.warn(`🤔 ${config.input_files} not include valid file.`);
throw new Error(`⚠️ ${config.input_files} not include valid file.`);
}
const currentAssets = rel.assets;
const assets = await Promise.all(
Expand Down

0 comments on commit 0a9ebaf

Please sign in to comment.