-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Fabrizio Cafolla
committed
Sep 19, 2024
1 parent
7157fdb
commit f2f7414
Showing
26 changed files
with
155 additions
and
242 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ permissions: | |
contents: read | ||
|
||
env: | ||
WORKSPACE: "production" | ||
WORKSPACE: ${{ secrets.WORKSPACE }} | ||
|
||
jobs: | ||
deploy-infrastructure: | ||
|
@@ -33,30 +33,39 @@ jobs: | |
with: | ||
ref: ${{ env.COMMIT_SHA }} | ||
|
||
- name: Terraform Init | ||
id: terraform | ||
uses: ./.github/workflows/actions/terraform-init | ||
timeout-minutes: 5 | ||
- name: Install devbox | ||
uses: jetify-com/[email protected] | ||
with: | ||
WORKSPACE: ${{ env.WORKSPACE }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | ||
AWS_ROLE_NAME: ${{ secrets.AWS_ROLE_NAME }} | ||
AWS_TERRAFORM_STATE_BUCKET: ${{ secrets.AWS_TERRAFORM_STATE_BUCKET }} | ||
enable-cache: "true" | ||
|
||
- name: Configure aws credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_ROLE_NAME }} | ||
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | ||
role-session-name: github-actions | ||
|
||
- name: Terraform Plan | ||
id: plan | ||
continue-on-error: true | ||
env: | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | ||
AWS_ROLE_NAME: ${{ secrets.AWS_ROLE_NAME }} | ||
run: | | ||
make check-drift | ||
devbox run infra check-drift | ||
exitcode=$? | ||
echo $exitcode | ||
echo "run_apply=${exitcode}" >> "$GITHUB_OUTPUT" | ||
- name: Terraform Apply | ||
if: ${{ steps.plan.outputs.run_apply == '2' }} | ||
env: | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | ||
AWS_ROLE_NAME: ${{ secrets.AWS_ROLE_NAME }} | ||
run: | | ||
make apply-auto-approve | ||
devbox run infra apply-auto-approve | ||
- name: Update comment | ||
if: ${{ success() && github.event.client_payload.slash_command.args.named.comment_id }} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,18 @@ | ||
name: Deploy Website | ||
|
||
permissions: read-all | ||
|
||
on: | ||
repository_dispatch: | ||
types: | ||
- deploy-website | ||
- deploy-website-command | ||
# push: | ||
# branches: | ||
# - main | ||
# paths: | ||
# - "website/**" | ||
# - "!website/tests/**" | ||
# - "!website/Makefile" | ||
# - "!website/README.md" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
# Permissions for terramform-init action | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
env: | ||
WORKSPACE: "production" | ||
|
||
jobs: | ||
deploy-website: | ||
name: Deploy | ||
|
@@ -45,40 +31,20 @@ jobs: | |
with: | ||
ref: ${{ env.COMMIT_SHA }} | ||
|
||
- name: Setup Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
cache: "pip" | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: "website/.nvmrc" | ||
cache-dependency-path: website/yarn.lock | ||
cache: "yarn" | ||
|
||
- name: Terraform Init | ||
id: terraform | ||
uses: ./.github/workflows/actions/terraform-init | ||
timeout-minutes: 5 | ||
- name: Install devbox | ||
uses: jetify-com/[email protected] | ||
with: | ||
WORKSPACE: ${{ env.WORKSPACE }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | ||
AWS_ROLE_NAME: ${{ secrets.AWS_ROLE_NAME }} | ||
AWS_TERRAFORM_STATE_BUCKET: ${{ secrets.AWS_TERRAFORM_STATE_BUCKET }} | ||
enable-cache: "true" | ||
|
||
- name: Build | ||
timeout-minutes: 5 | ||
run: | | ||
make setup-website VIRTUAL_ENV=false | ||
make build | ||
devbox run website build | ||
- name: Deploy | ||
timeout-minutes: 5 | ||
run: | | ||
make deploy | ||
devbox run deploy | ||
- name: Update comment | ||
if: ${{ success() && github.event.client_payload.slash_command.args.named.comment_id }} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
name: Sync Database | ||
|
||
permissions: read-all | ||
|
||
on: | ||
workflow_dispatch: | ||
repository_dispatch: | ||
types: | ||
- sync-database | ||
|
||
# Permissions for terramform-init action | ||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
env: | ||
WORKSPACE: "production" | ||
|
||
jobs: | ||
sync-database: | ||
name: Sync Database | ||
|
@@ -22,6 +16,11 @@ jobs: | |
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install devbox | ||
uses: jetify-com/[email protected] | ||
with: | ||
enable-cache: "true" | ||
|
||
- name: Load env | ||
id: env | ||
run: | | ||
|
@@ -35,7 +34,7 @@ jobs: | |
hash_commit_awesome_italia_opensource="${{ github.event.client_payload.hash }}" | ||
fi | ||
pr_body="${pr_body}\n\n Sync database pipeline: [${{ github.run_id }}](https://github.com/italia-opensource/italiaopensource.com/actions/runs/${{ github.run_id }})" | ||
pr_body="${pr_body}. Sync database pipeline: [${{ github.run_id }}](https://github.com/italia-opensource/italiaopensource.com/actions/runs/${{ github.run_id }})" | ||
echo "pr_branch_name=${pr_branch_name}" >> $GITHUB_OUTPUT | ||
echo "pr_branch_name=${pr_branch_name}" | ||
|
@@ -46,35 +45,11 @@ jobs: | |
echo "hash_commit_awesome_italia_opensource=${hash_commit_awesome_italia_opensource}" >> $GITHUB_OUTPUT | ||
echo "hash_commit_awesome_italia_opensource=${hash_commit_awesome_italia_opensource}" | ||
- name: Setup Python 3.12 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.12" | ||
cache: "pip" | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: "website/.nvmrc" | ||
cache-dependency-path: website/yarn.lock | ||
cache: "yarn" | ||
|
||
- name: Terraform Init | ||
id: terraform | ||
uses: ./.github/workflows/actions/terraform-init | ||
timeout-minutes: 5 | ||
with: | ||
WORKSPACE: ${{ env.WORKSPACE }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | ||
AWS_ROLE_NAME: ${{ secrets.AWS_ROLE_NAME }} | ||
AWS_TERRAFORM_STATE_BUCKET: ${{ secrets.AWS_TERRAFORM_STATE_BUCKET }} | ||
|
||
- name: Build | ||
id: build | ||
timeout-minutes: 5 | ||
run: | | ||
make download HASH_COMMIT="${{ steps.env.outputs.hash_commit_awesome_italia_opensource}}" | ||
devbox run website download HASH_COMMIT="${{ steps.env.outputs.hash_commit_awesome_italia_opensource}}" | ||
git checkout HEAD -- infrastructure/.terraform.lock.hcl # Ignore changes to the lock file | ||
status=$(git status -s) | ||
|
@@ -87,9 +62,6 @@ jobs: | |
exit 0 | ||
fi | ||
make setup-website VIRTUAL_ENV=false | ||
make build | ||
echo "has_changed=true" >> $GITHUB_OUTPUT | ||
- name: Create Pull Request | ||
|
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
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
Oops, something went wrong.