update the compress-cookbooks github action to also upload changes in… #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload Cookbooks & Configs to S3 | |
on: [push] | |
jobs: | |
compress: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Compress Cookbooks | |
run: | | |
cd .. | |
tar -czvf cookbooks.tar.gz -C ${{ github.workspace }} . | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Upload to staging S3 | |
run: | | |
aws s3 cp ${{ github.workspace }}/../cookbooks.tar.gz s3://${{ secrets.staging_s3_bucket }}/${{ github.ref_name }}/cookbooks.tar.gz | |
aws s3 cp ${{ github.workspace }}/.chef/environments s3://${{ secrets.staging_s3_bucket }}/${{ github.ref_name}}/environments --recursive | |
- name: Upload to prod S3 | |
if: github.ref == 'refs/heads/master' | |
run: | | |
aws s3 cp ${{ github.workspace }}/../cookbooks.tar.gz s3://${{ secrets.prod_s3_bucket }}/${{ github.ref_name }}/cookbooks.tar.gz | |
aws s3 cp ${{ github.workspace }}/.chef/environments s3://${{ secrets.prod_s3_bucket }}/${{ github.ref_name}}/environments --recursive |