Order feature work pages by latest published date #242
Workflow file for this run
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/[email protected] | |
- 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 | |
- 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 | |
- name: copy deploy file via ssh | |
uses: appleboy/[email protected] | |
env: | |
HOST: ${{ env.HOST }} | |
USERNAME: ${{ env.USERNAME }} | |
PORT: ${{ secrets.PORT }} | |
KEY: ${{ secrets.KEY }} | |
with: | |
source: 'deploy_script' | |
target: '.' | |
- name: run deployment | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ env.HOST }} | |
username: ${{ env.USERNAME }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
command_timeout: 30m | |
script: | | |
export BRANCH=${{ env.BRANCH }} | |
export RABBITMQ_PASSWORD=${{ secrets.RABBITMQ_PASSWORD }} | |
export ELASTIC_SEARCH_URL=${{ secrets.ELASTIC_SEARCH_URL }} | |
export ELASTIC_PASSWORD=${{ secrets.ELASTIC_PASSWORD }} | |
export SECRET_KEY="${{ secrets.SECRET_KEY }}" | |
export ELASTIC_USERNAME=${{ secrets.ELASTIC_USERNAME }} | |
export ENVIRONMENT=${{ env.ENVIRONMENT }} | |
export CELERY_BROKER_URL=${{ secrets.CELERY_BROKER_URL }} | |
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 HS_API_KEY=${{ secrets.HS_API_KEY }} | |
export HS_TICKET_PIPELINE=${{ secrets.HS_TICKET_PIPELINE }} | |
export HS_TICKET_PIPELINE_STAGE=${{ secrets.HS_TICKET_PIPELINE_STAGE }} | |
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 RABBITMQ_DEFAULT_USER=di_website | |
export RABBITMQ_DEFAULT_PASS=${{ secrets.RABBITMQ_PASSWORD }} | |
export RABBITMQ_DEFAULT_VHOST=myvhost | |
cp -r deploy_script/deploy.sh . | |
chmod +x deploy.sh && ./deploy.sh run |