Skip to content

Commit

Permalink
tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
miriamgoldman committed Jul 29, 2024
1 parent b0c110e commit 9422fde
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/standard-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Deploy to Pantheon
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
jobs:
configure_env:
name: Configure environment and Terminus
Expand Down Expand Up @@ -59,22 +59,10 @@ jobs:
with:
pantheon-machine-token: ${{ secrets.TERMINUS_TOKEN }}

# - name: Find canary sites
# id: findSites
# run: |
# # Get list of sites with the canary tag using the upstream in our organization
# SITES=$(terminus org:site:list --upstream="${{ vars.UPSTREAM_GUID }}" --tag="${{ vars.CANARY_TAG_NAME }}" --field="name" ${{ vars.ORG_GUID }})
# SITE_JSON=$(echo $SITES | jq -R -s -c 'split("\n") | map(select(length > 0))')
# # Export the list of sites for the matrix
# echo "sites=$SITE_JSON" >> $GITHUB_OUTPUT


deploy_to_pantheon:
runs-on: ubuntu-latest
needs: [ identify_sites, configure_env ]
# strategy:
# matrix:
# site: ${{ fromJSON(needs.identify_sites.outputs.sites) }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -96,8 +84,14 @@ jobs:
- name: Determine target environment for deploy
run: |
# Identify environment based on branch name
env=${{ github.ref_name }}
if [ "$env" == "master" ]; then
if [ "${{ github.event_name }}" = "pull_request" ]; then
# Use the PR number as the environment name
env=$(echo ${{ github.ref_name }} | sed 's|^\([0-9]*\)/.*|pr-\1|')
else
# Use the branch name as the environment name
env=${{ github.ref_name }}
fi
if [ "$env" == "main" ]; then
env="dev"
fi
Expand Down Expand Up @@ -131,7 +125,7 @@ jobs:
git push pantheon ${{ github.ref_name }}:$branch --force
spin_down:
name: Spin down environment
name: Spin down
needs: deploy_to_pantheon
if: always()
runs-on: ubuntu-latest
Expand Down

0 comments on commit 9422fde

Please sign in to comment.