Skip to content

Commit

Permalink
Merge pull request #1242 from devinit/patch/deploy-action
Browse files Browse the repository at this point in the history
Replace deprecated set-output usage
  • Loading branch information
edwinmp authored Oct 20, 2022
2 parents c99e6a0 + f17d099 commit eec6482
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
20 changes: 11 additions & 9 deletions .github/workflows/deploy_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
if: contains('
refs/heads/master
refs/heads/develop
', github.ref) || ${{ github.event.ref }} =~ ^refs/tags/*-beta* || ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+.[0-9]+.[0-9]+
', 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@v2
- name: zip deploy script
Expand All @@ -25,29 +25,31 @@ jobs:
cp deploy.sh deploy_script
tar -cvf deploy.tar deploy_script
- name: Extract branch name
- name: Set BRANCH env
shell: bash
run: echo "##[set-output name=branch;]${GITHUB_REF#refs/heads/}"
run: echo "BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
id: extract_branch
- name: Set env for develop branch
if: endsWith(github.ref, '/develop') || ${{ github.event.ref }} =~ ^refs/tags/*-beta*
- 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 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 "BRANCH=${{ steps.extract_branch.outputs.branch }}" >> $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: Set env for master branch
if: endsWith(github.ref, '/master') || ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+.[0-9]+.[0-9]+
- name: Set env for production
if: endsWith(github.ref, '/master') || 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 "BRANCH=${{ steps.extract_branch.outputs.branch }}" >> $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
Expand Down
2 changes: 1 addition & 1 deletion config/celery/default/celeryd
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CELERYD_NODES="worker1"
#CELERYD_NODES=10

# Absolute or relative path to the 'celery' command:
CELERY_BIN="/usr/bin/celery"
CELERY_BIN="/usr/local/bin/celery"
#CELERY_BIN="/virtualenvs/def/bin/celery"

# App instance to use
Expand Down
26 changes: 13 additions & 13 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,23 +136,23 @@ function perform_git_operations {
if [ -d $APP_DIR ]; then
cd $APP_DIR

{
# Move back to root directory
log "Cloning new content from active branch "$ACTIVE_BRANCH
git fetch
git stash
git checkout $ACTIVE_BRANCH
} || {
log "Failed to update from git repository"
exit 20;
}

if [[ $ACTIVE_BRANCH == *"refs/tags"* ]]
then
log "Deployment is from a release tag"
{
log "Cloning new content from a release tag "$ACTIVE_BRANCH
git fetch --tags -f
git stash
git checkout $ACTIVE_BRANCH
} || {
log "Failed to update from git repository"
exit 20;
}
else
{
log "Hard reset to target branch"
log "Cloning new content from active branch "$ACTIVE_BRANCH
git fetch
git stash
git checkout $ACTIVE_BRANCH
git reset --hard origin/$ACTIVE_BRANCH
} || {
log "Failed to update from git repository"
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ services:

worker:
depends_on:
- db
- web
- rabbitmq
build:
context: .
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ beautifulsoup4==4.8
bleach==5.0.1
elasticsearch>=7.0.0,<7.16.3
wagtail-linkchecker==0.6.0
celery==4.4.7
celery==4.4.7 # upgrade blocked by wagtail-linkchecker
wagtailgeowidget>=6.2.0,<7.0
xlrd>=1.0.0
boxsdk==2.6.1
Expand Down

0 comments on commit eec6482

Please sign in to comment.