Skip to content

Commit

Permalink
clean up workflows (#28)
Browse files Browse the repository at this point in the history
* move build-tag step

* fixed typo in cloudformation template

* delete PR stack on create failure

* annotate manual deploys with dispatch inputs

* rename step since we are using GITHUB_OUTPUT

* rename step since we are using GITHUB_OUTPUT
  • Loading branch information
ntno authored Dec 31, 2022
1 parent 0dcdc9c commit 6227e90
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/ci/s3-website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Resources:
- ServerSideEncryptionByDefault:
SSEAlgorithm: 'AES256'
DeletionPolicy: Delete
BuckeReadPolicy:
BucketReadPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: !Ref S3Bucket
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/dev-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ permissions:
contents: read

jobs:
report-inputs:
runs-on: ubuntu-latest
steps:
- name: Report Inputs
run: |
export MESSAGE="tag=${{ inputs.tag }}, env-vars=${{ inputs.env-vars }}, enable-dry-run=${{ inputs.enable-dry-run }}, enable-size-only-run=${{ inputs.enable-size-only-run }}, enable-quiet-run=${{ inputs.enable-quiet-run }}"
echo "::notice title=Worfklow Inputs::$MESSAGE"
check-out-tag:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -88,8 +95,8 @@ jobs:
ref: ${{ inputs.tag }}
- name: Install Buildenv
uses: ntno/setup-buildenv@v1
- name: Set Env Vars
id: set-env-vars
- name: Set Vars
id: set-vars
run: |
if [[ "${{ inputs.enable-dry-run }}" == "true" ]]; then
export DRY_RUN="DRY_RUN=1"
Expand All @@ -116,7 +123,7 @@ jobs:
env-name: ${{ inputs.env-vars }}
s3-bucket: ${{ env.deploy-target }}
aws-region: us-east-1
make-vars-for-deploy-target: ${{ steps.set-env-vars.outputs.deploy-flags }}
make-vars-for-deploy-target: ${{ steps.set-vars.outputs.deploy-flags }}
role-to-assume: ${{ secrets.DEVELOPMENT_IAM_ROLE_ARN }}
- name: Report Result
run: |
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,22 @@ jobs:
- name: set-revision-sha
id: set-revision-sha
run: echo "revision-sha=${{ github.sha }}" >> $GITHUB_OUTPUT
- name: set-build-tag
id: set-build-tag
run: |
git init
echo "build-tag=$( git rev-parse --short ${{ github.sha }} )" >> $GITHUB_OUTPUT
- name: stash-event-payload
id: stash-event-payload
run: |
mkdir -p ./details
cat ${{ github.event_path }} > ./details/event-payload.json
echo "artifact-name=details/event-payload.json" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v3
- name: upload-event-payload-artifact
uses: actions/upload-artifact@v3
with:
name: event-payload.json
path: ./details/
- name: set-build-tag
id: set-build-tag
run: |
git init
echo "build-tag=$( git rev-parse --short ${{ github.sha }} )" >> $GITHUB_OUTPUT
- name: inspect-outputs
id: inspect-outputs
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/open-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
--template-body file://s3-website.yml \
--stack-name "${{ env.stack-name }}" \
--parameters ParameterKey=BucketName,ParameterValue="${{ env.bucket-name }}" \
--on-failure DO_NOTHING \
--on-failure DELETE \
--capabilities CAPABILITY_NAMED_IAM
aws cloudformation wait stack-create-complete --stack-name "${{ env.stack-name }}"
aws s3 cp --sse AES256 --acl public-read index.html "s3://${{ env.bucket-name }}/"
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/pages-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ permissions:
contents: read

jobs:
report-inputs:
runs-on: ubuntu-latest
steps:
- name: Report Inputs
run: |
export MESSAGE="tag=${{ inputs.tag }}, env-vars=${{ inputs.env-vars }}"
echo "::notice title=Worfklow Inputs::$MESSAGE"
check-out-tag:
runs-on: ubuntu-latest
steps:
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ permissions:
contents: read

jobs:
report-inputs:
runs-on: ubuntu-latest
steps:
- name: Report Inputs
run: |
export MESSAGE="tag=${{ inputs.tag }}, env-vars=${{ inputs.env-vars }}, enable-dry-run=${{ inputs.enable-dry-run }}, enable-size-only-run=${{ inputs.enable-size-only-run }}, enable-quiet-run=${{ inputs.enable-quiet-run }}"
echo "::notice title=Worfklow Inputs::$MESSAGE"
check-out-tag:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -88,8 +95,8 @@ jobs:
ref: ${{ inputs.tag }}
- name: Install Buildenv
uses: ntno/setup-buildenv@v1
- name: Set Env Vars
id: set-env-vars
- name: Set Vars
id: set-vars
run: |
if [[ "${{ inputs.enable-dry-run }}" == "true" ]]; then
export DRY_RUN="DRY_RUN=1"
Expand All @@ -116,7 +123,7 @@ jobs:
env-name: ${{ inputs.env-vars }}
s3-bucket: ${{ env.deploy-target }}
aws-region: us-east-1
make-vars-for-deploy-target: ${{ steps.set-env-vars.outputs.deploy-flags }}
make-vars-for-deploy-target: ${{ steps.set-vars.outputs.deploy-flags }}
role-to-assume: ${{ secrets.PRODUCTION_IAM_ROLE_ARN }}
- name: Report Result
run: |
Expand Down

0 comments on commit 6227e90

Please sign in to comment.