Preview of pr 274 by varsanyid #205
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: PR Preview | |
run-name: Preview of pr ${{ github.event.pull_request.number }} by ${{ github.event.pull_request.user.login }} | |
on: | |
pull_request_target: | |
types: [opened, reopened, synchronize, closed] | |
permissions: | |
pull-requests: write # Required to add a comment to the PR | |
contents: read # Required to checkout the PR branch | |
jobs: | |
Deploy: | |
runs-on: ubuntu-20.04 | |
if: ${{ github.event.action != 'closed' }} | |
steps: | |
- name: Create the comment to be updated | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
message: | | |
### π· Deploy Preview for javalin.io processing. | |
| Name | Link | | |
|-|-| | |
| π¨ Latest commit | ${{ github.event.pull_request.head.sha }} | | |
| π Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | | |
- name: Checkout the PR branch | |
uses: actions/checkout@v3 | |
with: | |
ref: refs/pull/${{ github.event.pull_request.number }}/merge | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 18 | |
- name: Setup Ruby and Gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7.4 | |
bundler-cache: true | |
- name: Update contributor list | |
run: | | |
echo "Generating contributor list" | |
cd _data | |
node update-contributors.js | |
cd .. | |
- name: Build jekyll site | |
run: bundle exec jekyll build | |
- name: Install surge | |
run: npm install -g surge | |
- name: Deploy to surge | |
run: surge --project ./_site --token ${{ secrets.SURGE_TOKEN }} --domain javalin-pr-${{ github.event.pull_request.number }}-preview.surge.sh | |
- name: Update comment to Preview Ready | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
message: | | |
### β Deploy Preview for javalin.io ready! | |
| Name | Link | | |
|-|-| | |
| π¨ Latest commit | ${{ github.event.pull_request.head.sha }} | | |
| π Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | | |
| π Preview | https://javalin-pr-${{ github.event.pull_request.number }}-preview.surge.sh | | |
- if: ${{ failure() }} | |
name: Update comment to Preview Failed | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
message: | | |
### β Deploy Preview for javalin.io failed. | |
| Name | Link | | |
|-|-| | |
| π¨ Latest commit | ${{ github.event.pull_request.head.sha }} | | |
| π Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | | |
Teardown: | |
runs-on: ubuntu-20.04 | |
if: ${{ github.event.action == 'closed' }} | |
steps: | |
- name: Install surge | |
run: npm install -g surge | |
- name: Tear down surge | |
run: surge teardown javalin-pr-${{ github.event.pull_request.number }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }} | |
- name: Update comment to Preview Deleted | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
message: | | |
### π Deploy Preview for javalin.io deleted. | |
| Name | Link | | |
|-|-| | |
| π¨ Latest commit | ${{ github.event.pull_request.head.sha }} | | |
| π Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | | |
- if: ${{ failure() }} | |
name: Update comment to Preview Delete Failed | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
message: | | |
### β Delete Preview for javalin.io failed. | |
| Name | Link | | |
|-|-| | |
| π¨ Latest commit | ${{ github.event.pull_request.head.sha }} | | |
| π Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | | |