-
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.
Merge pull request #576 from Crown-Commercial-Service/deploy-from-github
Add the ability to deploy to GPaaS via GitHub actions
- Loading branch information
Showing
10 changed files
with
150 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: "Deploy latest code to GPaaS" | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
description: 'The name of the environment we are deploying to' | ||
required: true | ||
type: string | ||
secrets: | ||
CF_API: | ||
description: 'The GPaaS API' | ||
required: true | ||
CF_USERNAME: | ||
description: 'The GPaaS Username' | ||
required: true | ||
CF_PASSWORD: | ||
description: 'The GPaaS Password' | ||
required: true | ||
CF_ORG: | ||
description: 'The org to deploy to' | ||
required: true | ||
|
||
concurrency: | ||
group: deploy-${{ inputs.environment }} | ||
|
||
jobs: | ||
run-unit-tests: | ||
uses: ./.github/workflows/rubyonrails.yml | ||
|
||
run-docker-tests: | ||
uses: ./.github/workflows/docker-image.yml | ||
|
||
deploy-to-application: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- run-unit-tests | ||
- run-docker-tests | ||
environment: | ||
name: ${{ inputs.environment }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Deploy to GPaaS | ||
uses: citizen-of-planet-earth/cf-cli-action@master | ||
with: | ||
cf_api: ${{ secrets.CF_API }} | ||
cf_username: ${{ secrets.CF_USERNAME }} | ||
cf_password: ${{ secrets.CF_PASSWORD }} | ||
cf_org: ${{ secrets.CF_ORG }} | ||
cf_space: ${{ inputs.environment }} | ||
command: push -f config/manifests/${{ inputs.environment }}.yml --strategy rolling |
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
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,55 @@ | ||
name: "Set up deployment of latest code to GPaaS" | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
- staging | ||
- main | ||
|
||
jobs: | ||
determine-environment: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ENV_NAME: ${{ steps.determine_environment.outputs.ENV_NAME }} | ||
steps: | ||
- name: Determine the environment to deploy to | ||
id: determine_environment | ||
run: | | ||
echo "ENV_NAME=$( | ||
case ${{ github.ref }} in | ||
"refs/heads/develop") | ||
echo "development" | ||
;; | ||
"refs/heads/staging") | ||
echo "pre-production" | ||
;; | ||
"refs/heads/main") | ||
echo "production" | ||
;; | ||
*) | ||
echo "FAIL" | ||
;; | ||
esac | ||
)" >> $GITHUB_OUTPUT | ||
- name: Fail if not an environment | ||
run: | | ||
echo "ERROR: No environment found" | ||
exit 1 | ||
if: steps.determine_environment.outputs.ENV_NAME == 'FAIL' | ||
|
||
- name: Show where we are deploying to | ||
run: echo "We will deploy to ${{ steps.determine_environment.outputs.ENV_NAME }}" | ||
|
||
deploy-to-gpaas: | ||
uses: ./.github/workflows/deploy_to_gpaas.yml | ||
needs: | ||
- determine-environment | ||
with: | ||
environment: ${{ needs.determine-environment.outputs.ENV_NAME }} | ||
secrets: | ||
CF_API: ${{ secrets.CF_API }} | ||
CF_USERNAME: ${{ secrets.CF_USERNAME }} | ||
CF_PASSWORD: ${{ secrets.CF_PASSWORD }} | ||
CF_ORG: ${{ secrets.CF_ORG }} |
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,20 @@ | ||
name: "Run our tests" | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- develop | ||
- staging | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
run-unit-tests: | ||
uses: ./.github/workflows/rubyonrails.yml | ||
with: | ||
publish_test_report: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'develop' }} | ||
secrets: | ||
cc_test_reporter_id: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
|
||
run-docker-build: | ||
uses: ./.github/workflows/docker-image.yml |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.