diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f427623d..8e75dd7c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,86 +81,3 @@ jobs: bundler-cache: true - name: Lint Ruby files run: bundle exec rubocop --require rubocop-rails --format github - deploy_dev: - needs: [test] - if: github.ref == 'refs/heads/main' - runs-on: ubuntu-latest - strategy: - max-parallel: 1 - steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.ruby-version }} - - uses: actions/setup-node@v2-beta - with: - node-version: '20' - - name: 'Deploy dev' - env: - name: dev - url: 'https://dev.queens-awards-enterprise.service.gov.uk/' - CF_ENDPOINT: 'api.london.cloud.service.gov.uk' - CF_SPACE: dev - CF_APP: qae-dev - CF_USER: ${{ secrets.CF_USER }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_ORG: ${{ secrets.CF_ORG }} - SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - run: | - npm install -g yarn - wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add - - echo "deb [trusted=yes] https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list - sudo apt-get update - sudo apt-get install cf7-cli - cf -v - cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org - cf install-plugin blue-green-deploy -r CF-Community -f - ./bin/deploy - deploy_staging: - needs: [test] - if: github.ref == 'refs/heads/staging' - runs-on: ubuntu-latest - strategy: - max-parallel: 1 - steps: - - uses: actions/checkout@v2 - - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gems- - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ env.ruby-version }} - - uses: actions/setup-node@v2-beta - with: - node-version: '20' - - name: 'Deploy staging' - env: - name: staging - url: 'https://staging.queens-awards-enterprise.service.gov.uk/' - CF_ENDPOINT: 'api.london.cloud.service.gov.uk' - CF_SPACE: staging - CF_APP: qae-staging - CF_USER: ${{ secrets.CF_USER }} - CF_PASSWORD: ${{ secrets.CF_PASSWORD }} - CF_ORG: ${{ secrets.CF_ORG }} - SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - run: | - curl -v -L -o cf-cli_amd64.deb 'https://cli.run.pivotal.io/stable?release=debian64&source=github' - sudo dpkg -i cf-cli_amd64.deb - cf -v - cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org - cf install-plugin blue-green-deploy -r CF-Community -f - ./bin/deploy diff --git a/.github/workflows/slack_notification.yml b/.github/workflows/slack_notification.yml index 56fa9d6d5..74726a1ac 100644 --- a/.github/workflows/slack_notification.yml +++ b/.github/workflows/slack_notification.yml @@ -1,4 +1,4 @@ -name: Check for tests or deployment results +name: Check for workflow results on: workflow_run: workflows: ["CI","Dev deployment","Staging deployment","Production deployment"] @@ -28,22 +28,11 @@ jobs: done echo "::set-output name=suid::$suid" - - name: tests + - name: workflow-complete uses: ravsamhq/notify-slack-action@v2 - if: ${{ github.event.workflow_run.head_branch != 'main' && github.event.workflow_run.head_branch != 'staging' && github.event.workflow_run.head_branch != 'production' }} with: status: ${{ github.event.workflow_run.conclusion }} - notification_title: "Tests ${{github.event.workflow_run.conclusion}} on *${{github.event.workflow_run.head_branch}}* - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>" - message_format: "{emoji} *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <{repo_url}|{repo}>" - footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>" - mention_users: ${{ steps.extract_slack_id.outputs.suid }} - mention_users_when: "failure,warnings" - - name: deployment - uses: ravsamhq/notify-slack-action@v2 - if: ${{ github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'staging' || github.event.workflow_run.head_branch == 'production' }} - with: - status: ${{ github.event.workflow_run.conclusion }} - notification_title: "Deployment ${{github.event.workflow_run.conclusion}} on *${{github.event.workflow_run.head_branch}}* - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>" + notification_title: "Workflow ${{github.event.workflow_run.conclusion}} on *${{github.event.workflow_run.head_branch}}* - <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>" message_format: "{emoji} *${{github.event.workflow_run.name}}* ${{github.event.workflow_run.conclusion}} in <{repo_url}|{repo}>" footer: "Linked Repo <${{github.server_url}}/${{github.repository}}|${{github.repository}}> | <${{github.server_url}}/${{github.repository}}/actions/runs/${{github.event.workflow_run.id}}|View ${{github.event.workflow_run.conclusion}}>" mention_users: ${{ steps.extract_slack_id.outputs.suid }}