You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.7 KiB
59 lines
1.7 KiB
name: 'CI/CD Pipeline' |
|
|
|
on: |
|
push: |
|
branches: |
|
- main |
|
pull_request: |
|
workflow_dispatch: |
|
|
|
concurrency: 'production' |
|
|
|
defaults: |
|
run: |
|
shell: bash |
|
|
|
jobs: |
|
deploy: |
|
name: Deploy |
|
|
|
runs-on: ubuntu-latest |
|
environment: 'production' |
|
if: github.ref == 'refs/heads/main' |
|
needs: [lint, test] |
|
|
|
steps: |
|
- name: Checkout code |
|
uses: actions/checkout@v2 |
|
|
|
- name: Install cf client |
|
env: |
|
CF_CLI_VERSION: 7.0.0-beta.30 |
|
run: | |
|
curl -L "https://packages.cloudfoundry.org/stable?release=linux64-binary&version=${CF_CLI_VERSION}" | tar -zx -C /tmp |
|
sudo cp /tmp/cf7 /usr/local/bin/cf7 |
|
- name: Deploy |
|
env: |
|
CF_USERNAME: ${{ secrets.CF_USERNAME }} |
|
CF_PASSWORD: ${{ secrets.CF_PASSWORD }} |
|
CF_API_ENDPOINT: ${{ secrets.CF_API_ENDPOINT }} |
|
CF_SPACE: ${{ secrets.CF_SPACE }} |
|
CF_ORG: ${{ secrets.CF_ORG }} |
|
API_USER: ${{ secrets.API_USER }} |
|
API_KEY: ${{ secrets.API_KEY }} |
|
APP_NAME: dluhc-core-staging |
|
GOVUK_NOTIFY_API_KEY: ${{ secrets.GOVUK_NOTIFY_API_KEY }} |
|
APP_HOST: ${{ secrets.APP_HOST }} |
|
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} |
|
IMPORT_PAAS_INSTANCE: ${{ secrets.IMPORT_PAAS_INSTANCE }} |
|
run: | |
|
cf7 api $CF_API_ENDPOINT |
|
cf7 auth |
|
cf7 target -o $CF_ORG -s $CF_SPACE |
|
cf7 set-env $APP_NAME API_USER $API_USER |
|
cf7 set-env $APP_NAME API_KEY $API_KEY |
|
cf7 set-env $APP_NAME GOVUK_NOTIFY_API_KEY $GOVUK_NOTIFY_API_KEY |
|
cf7 set-env $APP_NAME APP_HOST $APP_HOST |
|
cf7 set-env $APP_NAME RAILS_MASTER_KEY $RAILS_MASTER_KEY |
|
cf7 set-env $APP_NAME IMPORT_PAAS_INSTANCE $IMPORT_PAAS_INSTANCE |
|
cf7 push $APP_NAME --strategy rolling
|
|
|