-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify website deployment workflows #1404
Changes from all commits
e128c95
27ac275
eec2cd7
feca0c2
32f743f
432a8d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,11 @@ on: | |
schedule: | ||
- cron: '0 9,18 * * *' | ||
|
||
concurrency: | ||
group: website-deployment | ||
# TODO: Enable cancel-in-progress once we are deploying per commit? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd let it finish – stopping the deployment halfway through or when the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Good point.
That's my understanding: There can be one workflow instance active and one pending. If another becomes pending, it replaces the previous pending workflow. |
||
#cancel-in-progress: true | ||
|
||
jobs: | ||
build_and_deploy: | ||
# Only run this workflow from the trunk branch and when it's triggered by another workflow OR dmsnell OR adamziel | ||
|
@@ -22,16 +27,36 @@ jobs: | |
# Specify runner + deployment step | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: playground-wordpress-net | ||
name: playground-wordpress-net-wp-cloud | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ./.github/actions/prepare-playground | ||
- run: npm run build | ||
- run: tar -czf wasm-wordpress-net.tar.gz dist/packages/playground/wasm-wordpress-net | ||
# Store dist/packages/artifacts/wasm-wordpress-net as a build artifact | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: playground-website | ||
path: wasm-wordpress-net.tar.gz | ||
# The artifact only becomes available after this workflow wraps up, so let's wrap. | ||
# The deploy-website.yml workflow will pick up the artifact and deploy it. | ||
|
||
- name: Deploy to playground.wordpress.net | ||
shell: bash | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "${{ secrets.DEPLOY_WEBSITE_TARGET_HOST_KEY }}" >> ~/.ssh/known_hosts | ||
echo "${{ secrets.DEPLOY_WEBSITE_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 | ||
chmod 0600 ~/.ssh/* | ||
|
||
# Website files | ||
rsync -avz -e "ssh -i ~/.ssh/id_ed25519" --delete \ | ||
dist/packages/playground/wasm-wordpress-net/ \ | ||
${{ secrets.DEPLOY_WEBSITE_TARGET_USER }}@${{ secrets.DEPLOY_WEBSITE_TARGET_HOST }}:'~/updated-playground-files' | ||
|
||
# Host-specific deployment scripts and server config | ||
rsync -avz -e "ssh -i ~/.ssh/id_ed25519" --delete \ | ||
packages/playground/website-deployment/ \ | ||
${{ secrets.DEPLOY_WEBSITE_TARGET_USER }}@${{ secrets.DEPLOY_WEBSITE_TARGET_HOST }}:'~/website-deployment' | ||
|
||
# Copy MIME types for use with PHP-served files | ||
scp -i ~/.ssh/id_ed25519 \ | ||
packages/php-wasm/universal/src/lib/mime-types.json \ | ||
${{ secrets.DEPLOY_WEBSITE_TARGET_USER }}@${{ secrets.DEPLOY_WEBSITE_TARGET_HOST }}:'~/website-deployment/' | ||
|
||
# Apply update | ||
ssh -i ~/.ssh/id_ed25519 \ | ||
${{ secrets.DEPLOY_WEBSITE_TARGET_USER }}@${{ secrets.DEPLOY_WEBSITE_TARGET_HOST }} \ | ||
-tt -C '~/website-deployment/apply-update.sh' |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This ensures that only one website deployment workflow can run at a time.