Skip to content

Latest commit

History

30 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Store Artifacts GitHub Action

Store job artifacts in GitHub.

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.

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. Optionally uploads a SAM artifact if specified.
  2. Uploads the job working directory as an artifact to GHA.

Usage

See below for inputs, outputs, and examples.

Inputs

  • 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.
  • template_file (optional): Path to SAM template file. This value is passed directly to ServerlessOpsIO/gha-package-aws-sam and is only used if use_aws_sam is true. This should not need changing and only set if you understand how the value is used by ServerlessOpsIO/gha-package-aws-sam
  • packaged_template_file (optional): Path to packaged SAM template file.
  • sam_s3_bucket (optional): S3 bucket for SAM deployment.
  • sam_s3_prefix (optional): S3 prefix for SAM deployment.

Outputs

  • 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.

Examples

To use this action see the examples below:

w/o AWS SAM

name: CIon: [push, pull_request]jobs:
build:
runs-on: ubuntu-lateststeps:
- name: Setup job workspaceid: setup-workspaceuses: ServerlessOpsIO/gha-setup-workspace@v2# Do job work here
- name: Store Artifactsuses: ServerlessOpsIO/gha-store-artifacts@v2

w/ AWS SAM

name: CIon: [push, pull_request]jobs:
build:
runs-on: ubuntu-latest# Required for AWS credentialspermissions:
id-token: writecontents: readsteps:
- name: Setup job workspaceid: setup-workspaceuses: ServerlessOpsIO/gha-setup-workspace@v2# Do job work here# NOTE: ERunning `sam build` prior ensures Lambda function dependencies will be properly# bundled in the artifact.
- name: SAM buildid: sam-buildshell: bashrun: sam build
- name: Assume AWS Credentialsuses: ServerlessOpsIO/gha-assume-aws-credentials@v1with:
build_aws_account_id: ${{ secrets.BUILD_AWS_ACCOUNT_ID }}deploy_aws_account_id: ${{ secrets.DEPLOY_AWS_ACCOUNT_ID }}aws_account_region: 'us-east-1'gha_build_role_name: ${{ secrets.GHA_BUILD_ROLE_NAME }}gha_deploy_role_name: ${{ secrets.GHA_DEPLOY_ROLE_NAME }}
- name: Store Artifactsuses: ServerlessOpsIO/gha-store-artifacts@v2with:
use_aws_sam: true

S3 Bucket

The default value for sam_s3_bucket comes from 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.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any changes.

Contact

For any questions or support, please open an issue in this repository.

About

GitHub Actions composite action to store artifacts

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors