Workflow file for this run
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
env: | |
AWS_REGION: eu-central-1 | |
AWS_ROLE: FirewallFactoryGithubPipelineRole | |
AWS_ACCOUNT: 859220371210 | |
permissions: | |
id-token: write | |
contents: read | |
on: | |
push: | |
branches: | |
- "**" | |
pull_request: | |
types: | |
- closed | |
- opened | |
- reopened | |
branches: | |
- "**" | |
jobs: | |
deploy_production_main: | |
name: Test and deploy OnlyManagedRuleGroups Firewall | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📦 Install Taskfile | |
run: | | |
npm install -g @go-task/cli | |
# Install node.js since we need npm to install cdk | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '18.x' | |
# Cache node modules for subsequent runs to reduce build times | |
- name: Cache Node.js modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
${{ runner.OS }}- | |
# Install cdk and typescript globally | |
- name: Install CDK and typescript globally | |
run: | | |
npm i -g aws-cdk typescript ts-node @types/node | |
npm link typescript | |
- name: 📦 Install Packages | |
run: | | |
npm install | |
- name: ⬇️ Checkout | |
uses: actions/checkout@v3 | |
- name: 🔑 Configure AWS credentials | |
uses: aws-actions/[email protected] | |
env: | |
ACCOUNT_ID: ${{ env.AWS_ACCOUNT }} | |
with: | |
role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ env.AWS_ROLE }} | |
aws-region: ${{ env.AWS_REGION }} | |
role-session-name: GitHubActionsSession | |
mask-aws-account-id: false | |
- name: ✚ Deploy Firewall to AWS | |
run: | | |
export CDK_DEFAULT_ACCOUNT=${{ env.ACCOUNT_ID }} | |
export CDK_DEFAULT_REGION=${{ env.AWS_REGION }} | |
task deploy config=onlyManagedRuleGroupsTests | |
- name: 🗑️ Remove Firewall from AWS | |
run: | | |
task destroy config=onlyManagedRuleGroupsTests |