Merge pull request #191 from ror-community/label-fix #66
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
name: Deploy Dev | |
on: | |
push: | |
branches: | |
- "dev" | |
paths-ignore: | |
- '**/README.md' | |
- '**/workflows/**' | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
S3_BUCKET: ${{ secrets.S3_BUCKET_SEARCH_DEV }} | |
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_DEV }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Extract branch name | |
shell: bash | |
run: | | |
echo "::set-output name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')" | |
echo "::set-output name=GIT_SHA::$(git rev-parse HEAD)" | |
echo "::set-output name=GIT_SHA_SHORT::$(git rev-parse --short HEAD)" | |
id: extract_variables | |
- name: Build | |
run: | | |
cp .env.dev .env; | |
yarn install --non-interactive | |
yarn test | |
yarn build | |
- name: Deploy | |
uses: reggionick/s3-deploy@v3 | |
with: | |
folder: dist | |
bucket: ${{ secrets.S3_BUCKET_SEARCH_DEV }} | |
bucket-region: ${{ secrets.S3_BUCKET_REGION }} | |
dist-id: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID_DEV }} | |
invalidation: /* | |
delete-removed: true | |
- name: Notify Slack | |
if: always() | |
uses: edge/simple-slack-notify@master | |
with: | |
channel: '#website-updates' | |
color: 'good' | |
text: 'Finished copying new content to server <https://dev.ror.org/search|dev.ror.org/search>...' | |
failure_text: '${env.GITHUB_WORKFLOW} (${env.GITHUB_RUN_NUMBER}) build failed' | |
fields: | | |
[{ "title": "Committed by", "value": "<https://github.com/ror-community/ror-app/commits?author=${{ github.actor }}|${{ github.actor }}>", "short": true }, | |
{ "title": "Commit SHA", "value": "<https://github.com/ror-community/ror-app/commit/${{ steps.extract_variables.outputs.GIT_SHA }}|${{ steps.extract_variables.outputs.GIT_SHA_SHORT }}>", "short": true }, | |
{ "title": "Repository", "value": "<https://github.com/${{ github.repository }}|${{ github.repository }}>", "short": true }, | |
{ "title": "Branch", "value": "<https://github.com/ror-community/ror-app/tree/${{ steps.extract_variables.outputs.BRANCH }}|${{ steps.extract_variables.outputs.BRANCH }}>", "short": true }] |