diff --git a/README.md b/README.md index c8c05fd..e8cc2f5 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,21 @@ Store job artifacts in GitHub. -This GitHub Action allows you to store artifacts generated during your workflow. It supports setting custom artifact names and retaining artifacts for a specified number of days. +This GitHub Action allows you to store artifacts generated during your workflow. It additionally supports packaging and storing AWS SAM artifacts for serverless applications. -For more information on what happens when `use_aws_sam` is true see [ServerlessOpsIO/gha-package-aws-sam](https://github.com/ServerlessOpsIO/gha-deploy-aws-sam/actions). +For more information on what happens when `use_aws_sam` is true see [ServerlessOpsIO/gha-package-aws-sam](https://github.com/ServerlessOpsIO/gha-deploy-aws-sam). _**NOTE: This workflow is opinionated and meets the needs of its author. It is provided publicly as a reference for others to use and modify as needed.**_ The `gha-store-artifacts` action performs the following tasks: -1. Checks if the GitHub environment variable `GITHUB_REPOSITORY_OWNER_PART_SLUG_URL` is set and fails if not. -2. Optionally uploads a SAM artifact if specified. -3. Sets the artifact name based on the provided override or generates a default name. -4. Uploads the job working directory as an artifact to GHA +1. Optionally uploads a SAM artifact if specified. +1. Uploads the job working directory as an artifact to GHA. ## Usage See below for inputs, outputs, and examples. ### Inputs -- `artifact_name_override` (optional): Override the name of the artifact. - `artifact_retention_days` (optional): Number of days to retain artifacts.. - `use_aws_sam` (optional): Boolean to determine if SAM artifact should be uploaded. - `aws_account_region` (optional): AWS region to use for SAM packaging. @@ -28,7 +25,6 @@ See below for inputs, outputs, and examples. ### Outputs -- `artifact-name`: The name of the artifact stored. - `sam-artifact-bucket`: The S3 bucket where the SAM artifact was uploaded. - `sam-artifact-bucket-prefix`: The S3 prefix where the SAM artifact was uploaded. @@ -102,38 +98,6 @@ jobs: ``` -#### Artifact naming -Both [ServerlessOpsIO/gha-setup-workspace](https://github.com/ServerlessOpsIO/gha-setup-workspace) and [ServerlessOpsIO/gha-store-artifacts](https://github.com/ServerlessOpsIO/gha-store-artifacts) use the same [utility action](https://github.com/ServerlessOpsIO/gha-artifact-name) to set an artifact name if `artifact_name_override` is not set. If your workflow sets _artifact_name_override_ for `ServerlessOpsIO/gha-setup-workspace` be sure to use that actions _artifact_name_ output to set _artifact_name_override_ for `ServerlessOpsIO/gha-store-artifacts`. - -See the example below: - -```yaml -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Setup job workspace - uses: ServerlessOpsIO/gha-setup-workspace@v1 - - name: Store Artifacts - uses: ServerlessOpsIO/gha-store-artifacts@v1 - with: - artifact_name_override: 'MyArtifactName' - outputs: - artifact-name: ${{ steps.setup-workspace.outputs.artifact-name }} - - deploy: - runs-on: ubuntu-latest - needs: - - build - steps: - - name: Setup job workspace - uses: ServerlessOpsIO/gha-setup-workspace@v1 - with: - checkout_artifact: true - artifact_name_override: ${{ needs.build.outputs.artifact-name }} - -``` - #### S3 Bucket The default value for `sam_s3_bucket` comes from [ServerlessOpsIO/aws-gha-integration](https://github.com/ServerlessOpsIO/aws-gha-integration). Both the `sam_s3_bucket` and `sam_s3_prefix` should not need to be configured but are avavailbel for unique circumstances. diff --git a/action.yaml b/action.yaml index 8125e7c..dc1d713 100644 --- a/action.yaml +++ b/action.yaml @@ -9,9 +9,6 @@ inputs: description: AWS region to deploy to required: false default: us-east-1 - artifact_name_override: - description: Override name of artifact - required: false artifact_retention_days: description: Number of days to retain artifacts required: false @@ -31,15 +28,9 @@ inputs: runs: using: composite steps: - - name: Set artifact name - id: set-artifact-name - uses: ServerlessOpsIO/gha-artifact-name@v1 - with: - artifact_name_override: ${{ inputs.artifact_name_override }} - - name: Package & Upload SAM artifact id: package-sam - if: ${{ inputs.use_aws_sam }} + if: ${{ inputs.use_aws_sam == 'true' }} uses: ServerlessOpsIO/gha-package-aws-sam@v1 with: aws_account_region: ${{ inputs.aws_account_region }} @@ -51,7 +42,6 @@ runs: id: upload-artifact uses: actions/upload-artifact@v4 with: - name: ${{ steps.set-artifact-name.outputs.artifact-name }} path: | **/* !.aws-sam/build @@ -61,9 +51,6 @@ runs: retention-days: ${{ inputs.artifact_retention_days }} outputs: - artifact-name: - description: Name of artifact stored - value: ${{ steps.set-artifact-name.outputs.artifact-name }} packaged-template: description: Path to packaged SAM template file value: ${{ steps.package-sam.outputs.packaged-template }}