Bump webpack-dev-middleware and webpack-dev-server (#1387) #285
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 | |
on: | |
push: | |
branches: | |
- develop | |
tags: | |
- '*-beta*' | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
if: contains(' | |
refs/heads/master | |
refs/heads/develop | |
', github.ref) || ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+.[0-9]+.[0-9]+-beta* || ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+.[0-9]+.[0-9]+ | |
steps: | |
- uses: actions/checkout@v3.5.0 | |
- name: zip deploy script | |
run: | | |
mkdir deploy_script | |
cp deploy.sh deploy_script | |
tar -cvf deploy.tar deploy_script | |
- name: Set BRANCH env | |
shell: bash | |
run: echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
id: extract_branch | |
- name: Get Version | |
if: ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+.[0-9]+.[0-9] | |
run: echo "TAG=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV | |
- name: Set env for production if release and not beta | |
if: startsWith(github.ref, 'refs/tags/v') && ( contains(env.TAG, '-beta') != true ) | |
run: | | |
echo "ENVIRONMENT=${{ secrets.PROD_ENV }}" >> $GITHUB_ENV | |
echo "HOST=${{ secrets.PROD_HOST }}" >> $GITHUB_ENV | |
echo "USERNAME=${{ secrets.USERNAME }}" >> $GITHUB_ENV | |
echo "WWW_SITE_URL=www.devinit.org" >> $GITHUB_ENV | |
echo "SITE_URL=devinit.org" >> $GITHUB_ENV | |
echo "DATA_SITE_URL=data.devinit.org" >> $GITHUB_ENV | |
echo "USE_SPACES=TRUE" >> $GITHUB_ENV | |
echo "AWS_S3_ENDPOINT_URL=${{ secrets.PROD_S3_ENDPOINT_URL }}" >> $GITHUB_ENV | |
echo "AWS_STORAGE_BUCKET_NAME=${{ secrets.PROD_STORAGE_BUCKET_NAME }}" >> $GITHUB_ENV | |
echo "AWS_ACCESS_KEY_ID=${{ secrets.PROD_S3_ACCESS_KEY_ID }}" >> $GITHUB_ENV | |
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.PROD_S3_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV | |
- name: Set env for staging or dev | |
if: endsWith(github.ref, '/develop') || contains(env.TAG, '-beta') | |
run: | | |
echo "ENVIRONMENT=${{ secrets.DEV_ENV }}" >> $GITHUB_ENV | |
echo "HOST=${{ secrets.DEV_HOST }}" >> $GITHUB_ENV | |
echo "USERNAME=${{ secrets.USERNAME }}" >> $GITHUB_ENV | |
echo "WWW_SITE_URL=dev.devinit.org" >> $GITHUB_ENV | |
echo "SITE_URL=dev.devinit.org" >> $GITHUB_ENV | |
echo "DATA_SITE_URL=dev.devinit.org" >> $GITHUB_ENV | |
echo "USE_SPACES=TRUE" >> $GITHUB_ENV | |
echo "AWS_S3_ENDPOINT_URL=${{ secrets.DEV_S3_ENDPOINT_URL }}" >> $GITHUB_ENV | |
echo "AWS_STORAGE_BUCKET_NAME=${{ secrets.DEV_STORAGE_BUCKET_NAME }}" >> $GITHUB_ENV | |
echo "AWS_ACCESS_KEY_ID=${{ secrets.DEV_S3_ACCESS_KEY_ID }}" >> $GITHUB_ENV | |
echo "AWS_SECRET_ACCESS_KEY=${{ secrets.DEV_S3_SECRET_ACCESS_KEY }}" >> $GITHUB_ENV | |
- name: copy deploy file via ssh | |
uses: appleboy/scp-action@v0.1.4 | |
with: | |
host: ${{ env.HOST }} | |
username: ${{ env.USERNAME }} | |
port: ${{ secrets.PORT }} | |
key: ${{ secrets.KEY }} | |
source: 'deploy_script' | |
target: '.' | |
- name: run deployment | |
uses: appleboy/ssh-action@v1.0.0 | |
with: | |
host: ${{ env.HOST }} | |
username: ${{ env.USERNAME }} | |
port: ${{ secrets.PORT }} | |
key: ${{ secrets.KEY }} | |
command_timeout: 30m | |
script: | | |
export BRANCH=${{ env.BRANCH }} | |
export SECRET_KEY="${{ secrets.SECRET_KEY }}" | |
export ENVIRONMENT=${{ env.ENVIRONMENT }} | |
export DATABASE_URL=${{ secrets.DATABASE_URL }} | |
export DEFAULT_FROM_EMAIL=${{ secrets.DEFAULT_FROM_EMAIL }} | |
export EMAIL_HOST=${{ secrets.EMAIL_HOST }} | |
export EMAIL_BACKEND=${{ secrets.EMAIL_BACKEND }} | |
export EMAIL_HOST_USER=${{ secrets.EMAIL_HOST_USER }} | |
export EMAIL_HOST_PASSWORD=${{secrets.EMAIL_HOST_PASSWORD }} | |
export GITHUB_TOKEN=${{ secrets.TOKEN_GITHUB }} | |
export SITE_URL=${{ env.SITE_URL }} | |
export WWW_SITE_URL=${{ env.WWW_SITE_URL }} | |
export DATA_SITE_URL=${{ env.DATA_SITE_URL }} | |
export USE_SPACES=${{ env.USE_SPACES }} | |
export AWS_S3_ENDPOINT_URL=${{ env.AWS_S3_ENDPOINT_URL }} | |
export AWS_STORAGE_BUCKET_NAME=${{ env.AWS_STORAGE_BUCKET_NAME }} | |
export AWS_ACCESS_KEY_ID=${{ env.AWS_ACCESS_KEY_ID }} | |
export AWS_SECRET_ACCESS_KEY=${{ env.AWS_SECRET_ACCESS_KEY }} | |
cp -r deploy_script/deploy.sh . | |
chmod +x deploy.sh && ./deploy.sh run |