Skip to content

Commit

Permalink
Upgrade deps and drop unnecessary dependencies (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo committed Dec 14, 2023
1 parent 490e8b9 commit 5d472e4
Show file tree
Hide file tree
Showing 19 changed files with 1,095 additions and 1,721 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/integration.yml
Expand Up @@ -25,16 +25,16 @@ jobs:
runs-on: 'ubuntu-latest'

steps:
- uses: 'actions/checkout@v3'
- uses: 'actions/checkout@v4'

- uses: 'actions/setup-node@v3'
- uses: 'actions/setup-node@v4'
with:
node-version: '16.x'
node-version: '20.x'

- name: 'npm build'
run: 'npm ci && npm run build'

- uses: 'google-github-actions/auth@main'
- uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/unit.yml
Expand Up @@ -32,11 +32,11 @@ jobs:
- 'macos-latest'

steps:
- uses: 'actions/checkout@v3'
- uses: 'actions/checkout@v4'

- uses: 'actions/setup-node@v3'
- uses: 'actions/setup-node@v4'
with:
node-version: '16.x'
node-version: '20.x'

- name: 'npm build'
run: 'npm ci && npm run build'
Expand All @@ -48,7 +48,7 @@ jobs:
run: 'npm run lint'

# Only authenticate if this is a full CI run.
- uses: 'google-github-actions/auth@main'
- uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: '${{ vars.WIF_PROVIDER_NAME }}'
service_account: '${{ vars.SERVICE_ACCOUNT_EMAIL }}'
Expand Down
43 changes: 25 additions & 18 deletions README.md
Expand Up @@ -23,6 +23,12 @@ support](https://cloud.google.com/support).**

## Usage

> **⚠️ WARNING!** The Node.js runtime has [known issues with unicode characters
> in filepaths on Windows][nodejs-unicode-windows]. There is nothing we can do
> to fix this issue in our GitHub Action. If you use unicode or special
> characters in your filenames, please use `gsutil` or `gcloud` to upload
> instead.
### For uploading a file

```yaml
Expand All @@ -34,23 +40,23 @@ jobs:

steps:
- id: 'checkout'
uses: 'actions/checkout@v3'
uses: 'actions/checkout@v4'

- id: 'auth'
uses: 'google-github-actions/auth@v1'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'

- id: 'upload-file'
uses: 'google-github-actions/upload-cloud-storage@v1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: '/path/to/file'
destination: 'bucket-name/file'

# Example of using the output
- id: 'uploaded-files'
uses: 'foo/bar@main'
uses: 'foo/bar@v1'
env:
file: '${{ steps.upload-file.outputs.uploaded }}'
```
Expand All @@ -68,23 +74,23 @@ jobs:

steps:
- id: 'checkout'
uses: 'actions/checkout@v3'
uses: 'actions/checkout@v4'

- id: 'auth'
uses: 'google-github-actions/auth@v1'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'

- id: 'upload-folder'
uses: 'google-github-actions/upload-cloud-storage@v1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: '/path/to/folder'
destination: 'bucket-name'

# Example of using the output
- id: 'uploaded-files'
uses: 'foo/bar@main'
uses: 'foo/bar@v1'
env:
files: '${{ steps.upload-folder.outputs.uploaded }}'
```
Expand All @@ -107,7 +113,7 @@ With default configuration

```yaml
- id: 'upload-files'
uses: 'google-github-actions/upload-cloud-storage@v1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: 'myfolder'
destination: 'bucket-name'
Expand All @@ -119,7 +125,7 @@ Optionally, you can also specify a prefix in destination.

```yaml
- id: 'upload-files'
uses: 'google-github-actions/upload-cloud-storage@v1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: 'myfolder'
destination: 'bucket-name/myprefix'
Expand All @@ -134,7 +140,7 @@ Setting `parent` to false will omit `path` when uploading to bucket.

```yaml
- id: 'upload-files'
uses: 'google-github-actions/upload-cloud-storage@v1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: 'myfolder'
destination: 'bucket-name'
Expand All @@ -149,7 +155,7 @@ Optionally, you can also specify a prefix in destination.

```yaml
- id: 'upload-files'
uses: 'google-github-actions/upload-cloud-storage@v1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: 'myfolder'
destination: 'bucket-name/myprefix'
Expand All @@ -164,7 +170,7 @@ You can specify a glob pattern like

```yaml
- id: 'upload-files'
uses: 'google-github-actions/upload-cloud-storage@v1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: 'myfolder'
destination: 'bucket-name'
Expand Down Expand Up @@ -304,7 +310,7 @@ For example:

```yaml
- id: 'upload-file'
uses: 'google-github-actions/upload-cloud-storage@v1'
uses: 'google-github-actions/upload-cloud-storage@v2'
with:
path: '/path/to/file'
destination: 'bucket-name/file'
Expand All @@ -314,7 +320,7 @@ will be available in future steps as the output "uploaded":

```yaml
- id: 'publish'
uses: 'foo/bar@main'
uses: 'foo/bar@v1'
env:
file: '${{ steps.upload-file.outputs.uploaded }}'
```
Expand All @@ -339,12 +345,12 @@ jobs:

steps:
- id: 'auth'
uses: 'google-github-actions/auth@v1'
uses: 'google-github-actions/auth@v2'
with:
workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'
service_account: 'my-service-account@my-project.iam.gserviceaccount.com'

- uses: 'google-github-actions/upload-cloud-storage@v1'
- uses: 'google-github-actions/upload-cloud-storage@v2'
```

### Via Application Default Credentials
Expand All @@ -359,7 +365,7 @@ jobs:
job_id:
steps:
- id: 'upload-file'
uses: 'google-github-actions/upload-cloud-storage@v1'
uses: 'google-github-actions/upload-cloud-storage@v2'
```

The action will automatically detect and use the Application Default
Expand All @@ -368,3 +374,4 @@ Credentials.
[gcs]: https://cloud.google.com/storage
[wif]: https://cloud.google.com/iam/docs/workload-identity-federation
[sa]: https://cloud.google.com/iam/docs/creating-managing-service-accounts
[nodejs-unicode-windows]: https://github.com/nodejs/node/issues/48673
2 changes: 1 addition & 1 deletion action.yml
Expand Up @@ -63,5 +63,5 @@ branding:
color: 'blue'

runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
19 changes: 19 additions & 0 deletions bin/runTests.sh
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -eEuo pipefail

#
# As of Node 20, the --test parameter does not support globbing, and it does not
# support variable Windows paths. We also cannot invoke the test runner
# directly, because while it has an API, there's no way to force it to transpile
# the Typescript into JavaScript before passing it to the runner.
#
# So we're left with this solution, which shells out to Node to list all files
# that end in *.test.ts (excluding node_modules/), and then execs out to that
# process. We have to exec so the stderr/stdout and exit code is appropriately
# fed to the caller.
#

FILES="$(node -e "process.stdout.write(require('node:fs').readdirSync('./', { recursive: true }).filter((e) => {return e.endsWith('.test.ts') && !e.startsWith('node_modules');}).sort().join(' '));")"

set -x
exec node --require ts-node/register --test-reporter spec --test ${FILES}
256 changes: 124 additions & 132 deletions dist/index.js

Large diffs are not rendered by default.

0 comments on commit 5d472e4

Please sign in to comment.