-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #583 from NYPL/SFR-2404/full-cicd
SFR-2404: Implement full ci/cd workflow
- Loading branch information
Showing
5 changed files
with
48 additions
and
28 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 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 |
---|---|---|
|
@@ -2,44 +2,33 @@ | |
# build a container and deploy to ECR | ||
name: Publish Production | ||
on: | ||
pull_request: | ||
branches: [production] | ||
types: [closed] | ||
workflow_call: | ||
|
||
jobs: | ||
tag_release: | ||
name: Tag and Release | ||
# only run if PR is merged (not just closed) | ||
if: github.event.pull_request.merged | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# the tag will match the package.json version (eg. v1.0.0) | ||
- name: Tag | ||
id: autotagger | ||
uses: butlerlogic/[email protected] | ||
env: | ||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | ||
- name: Bump version and push tag | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
with: | ||
strategy: package | ||
tag_prefix: v | ||
# use the body of the PR commit as the tag message | ||
tag_message: ${{ github.event.pull_request.body }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Release | ||
id: create_release | ||
if: steps.autotagger.outputs.tagname != '' | ||
if: steps.tag_version.outputs.new_tag != '' | ||
uses: softprops/action-gh-release@v2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ steps.autotagger.outputs.tagname }} | ||
name: ${{ steps.autotagger.outputs.tagname }} | ||
# use the body of the PR commit as the release body | ||
body: ${{ github.event.pull_request.body }} | ||
tag_name: ${{ steps.tag_version.outputs.new_tag }} | ||
name: ${{ steps.tag_version.outputs.new_tag }} | ||
body: ${{ steps.tag_version.outputs.changelog }} | ||
draft: false | ||
prerelease: false | ||
|
||
publish_qa: | ||
name: Publish image to ECR | ||
if: github.event.pull_request.merged | ||
|
@@ -85,4 +74,4 @@ jobs: | |
- name: Force ECS Update | ||
run: | | ||
aws ecs update-service --cluster sfr-frontend-production-tf --service sfr-frontend-production-tf --force-new-deployment | ||
aws ecs update-service --cluster sfr-frontend-production-tf --service sfr-frontend-production-tf --force-new-deployment |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Full CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
# Job to deploy to the QA environment on successful merge to `main` | ||
deploy_to_qa: | ||
uses: NYPL/sfr-bookfinder-front-end/.github/workflows/build-qa.yml@main | ||
secrets: inherit | ||
|
||
# Job to run e2e tests on the QA environment after deployment | ||
run_e2e_tests: | ||
needs: deploy_to_qa | ||
uses: NYPL/sfr-bookfinder-front-end/.github/workflows/Playwright.yml@main | ||
with: | ||
base_url: "https://drb-qa.nypl.org/" | ||
secrets: inherit | ||
|
||
# Job to deploy to production after successful e2e tests on QA | ||
deploy_to_production: | ||
needs: run_e2e_tests | ||
uses: NYPL/sfr-bookfinder-front-end/.github/workflows/build-production.yaml@main | ||
secrets: inherit |
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