Skip to content

Commit

Permalink
Clean up unit and integration tests, remove labeler (#305)
Browse files Browse the repository at this point in the history
This also removes references to the "credentials" input which is no
longer used.
  • Loading branch information
sethvargo committed Dec 7, 2022
1 parent a5b77a3 commit 5be2952
Show file tree
Hide file tree
Showing 7 changed files with 424 additions and 414 deletions.
44 changes: 6 additions & 38 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'integration'
name: 'Integration'

on:
push:
Expand All @@ -13,47 +13,15 @@ concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
cancel-in-progress: true

permissions:
contents: 'read'
id-token: 'write'

jobs:
auth_json:
integration:
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
name: 'auth_json'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v3'

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

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

- uses: 'google-github-actions/auth@main'
with:
credentials_json: '${{ secrets.UPLOAD_CLOUD_STORAGE_GCP_SA_KEY_JSON }}'

- name: 'Create files'
run: |-
mkdir -p test
touch test/test2.txt
- id: 'upload'
name: 'Upload files'
uses: './'
with:
path: './test/test2.txt'
destination: '${{ secrets.UPLOAD_CLOUD_STORAGE_TEST_BUCKET }}/testprefix'

- name: 'Get output'
run: 'echo "${{ steps.upload.outputs.uploaded }}"'

auth_workload_identity_federation:
if: ${{ github.event_name == 'push' || github.repository == github.event.pull_request.head.repo.full_name && github.actor != 'dependabot[bot]' }}
name: 'auth_workload_identity_federation'
permissions:
contents: 'read'
id-token: 'write'
runs-on: 'ubuntu-latest'
steps:
- uses: 'actions/checkout@v3'

Expand Down
17 changes: 0 additions & 17 deletions .github/workflows/label.yml

This file was deleted.

3 changes: 1 addition & 2 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'unit'
name: 'Unit'

on:
push:
Expand All @@ -15,7 +15,6 @@ concurrency:

jobs:
unit:
name: 'unit'
runs-on: '${{ matrix.os }}'

permissions:
Expand Down
55 changes: 11 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
<!--
Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# upload-cloud-storage

This action uploads files/folders to a [Google Cloud Storage (GCS)][gcs] bucket. This is useful when
you want upload build artifacts from your workflow.
The `upload-cloud-storage` GitHub Action uploads files to a [Google Cloud
Storage (GCS)][gcs] bucket.

Paths to files that are successfully uploaded are set as output variables and can be
used in subsequent steps.
Paths to files that are successfully uploaded are set as output variables and
can be used in subsequent steps.

## Prerequisites

- This action requires Google Cloud credentials that are authorized to upload
blobs to the specified bucket. See the Authorization section below for more
information.
blobs to the specified bucket. See the [Authorization](#authorization)
section below for more information.

- This action runs using Node 16. If you are using self-hosted GitHub Actions
runners, you must use runner version [2.285.0](https://github.com/actions/virtual-environments)
Expand Down Expand Up @@ -295,8 +279,7 @@ If `parent` is set to `false`, it wil be uploaded to `gs://bucket-name/folder2/f
```

- `project_id` - (Optional) Google Cloud project ID to use for billing and API
requests. By default, this is extracted from the credentials or the running
environment.
requests. By default, this is extracted from the running environment.

```yaml
project_id: 'my-project'
Expand Down Expand Up @@ -332,11 +315,9 @@ permissions to access the secrets being requested.

### Via google-github-actions/auth

Use [google-github-actions/auth](https://github.com/google-github-actions/auth) to authenticate the action. You can use [Workload Identity Federation][wif] or traditional [Service Account Key JSON][sa] authentication by specifying the `credentials` input. This Action supports both the recommended [Workload Identity Federation][wif] based authentication and the traditional [Service Account Key JSON][sa] based auth.

See [usage](https://github.com/google-github-actions/auth#usage) for more details.

#### Authenticating via Workload Identity Federation
Use [google-github-actions/auth](https://github.com/google-github-actions/auth)
to authenticate the action. You can use [Workload Identity Federation][wif] or
traditional [Service Account Key JSON][sa] authentication.

```yaml
jobs:
Expand All @@ -355,20 +336,6 @@ jobs:
- uses: 'google-github-actions/upload-cloud-storage@v1'
```

#### Authenticating via Service Account Key JSON

```yaml
jobs:
job_id:
steps:
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.gcp_credentials }}'

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

### Via Application Default Credentials

If you are hosting your own runners, **and** those runners are on Google Cloud,
Expand All @@ -389,4 +356,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
[sa]: https://cloud.google.com/iam/docs/creating-managing-service-accounts
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
project_id:
description: |-
Project ID to use for making requests. By default, this is extracted from
the credentials or the running environment.
the running environment.
required: false
path:
description: |-
Expand Down
Loading

0 comments on commit 5be2952

Please sign in to comment.