|
38 | 38 | run: |
|
39 | 39 | export CURL_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
|
40 | 40 | bash ./scripts/code-coverage.sh
|
| 41 | + - name: Configure AWS credentials |
| 42 | + uses: aws-actions/configure-aws-credentials@v1 |
| 43 | + with: |
| 44 | + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 45 | + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 46 | + aws-region: eu-west-1 |
| 47 | + - name: Zip and Send to S3 |
| 48 | + env: |
| 49 | + AWS_S3_CODE_BUCKET: ${{ secrets.AWS_S3_CODE_BUCKET }} |
| 50 | + run: | |
| 51 | + echo $GITHUB_REPOSITORY |
| 52 | + repo_slug=`echo $GITHUB_REPOSITORY | awk -F '/' '{print $2}'`; |
| 53 | + echo $repo_slug |
| 54 | + echo $GITHUB_SHA |
| 55 | + echo $GITHUB_SHA > release |
| 56 | + if test "$GITHUB_REF" = "refs/heads/main"; then |
| 57 | + echo "Branch is main - no need to make a release name..." |
| 58 | + else |
| 59 | + echo "Making a release name for non-main branch..." |
| 60 | + branch=`echo $GITHUB_REF | awk -F '/' '{print $3}'` |
| 61 | + release_name=`echo $GITHUB_ACTOR-$branch` |
| 62 | + echo "Release name: $release_name" |
| 63 | + echo $release_name > release_name |
| 64 | + echo "Created a release_name file" |
| 65 | + fi |
| 66 | + zip -r app.zip . |
| 67 | + aws s3 cp app.zip "s3://$AWS_S3_CODE_BUCKET/$repo_slug.zip" |
| 68 | + - name: Send build success notification |
| 69 | + if: success() |
| 70 | + |
| 71 | + env: |
| 72 | + SLACK_MESSAGE: ${{ github.repository }} build ${{ github.run_number }} launched by ${{ github.actor }} has succeeded |
| 73 | + SLACK_TITLE: Build Success |
| 74 | + SLACK_CHANNEL: city-modelling-feeds |
| 75 | + SLACK_USERNAME: GitHub Build Bot |
| 76 | + SLACK_ICON: https://slack-files2.s3-us-west-2.amazonaws.com/avatars/2017-12-19/288981919427_f45f04edd92902a96859_512.png |
| 77 | + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
| 78 | + - name: Send build failure notification |
| 79 | + if: failure() |
| 80 | + |
| 81 | + env: |
| 82 | + SLACK_COLOR: '#FF0000' |
| 83 | + SLACK_MESSAGE: ${{ github.repository }} build ${{ github.run_number }} launched by ${{ github.actor }} has failed |
| 84 | + SLACK_TITLE: Build Failure! |
| 85 | + SLACK_CHANNEL: city-modelling-feeds |
| 86 | + SLACK_USERNAME: GitHub Build Bot |
| 87 | + SLACK_ICON: https://slack-files2.s3-us-west-2.amazonaws.com/avatars/2017-12-19/288981919427_f45f04edd92902a96859_512.png |
| 88 | + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
0 commit comments