Bump webrick from 1.8.1 to 1.8.2 #2093
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 Preview | |
on: [pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get Pullrequest ID | |
id: prepare | |
run: | | |
export PULLREQUEST_ID=$(echo "${{ github.ref }}" | cut -d "/" -f3) | |
echo "prid=$PULLREQUEST_ID" >> $GITHUB_OUTPUT | |
if [ $(expr length "${{ secrets.USERNAME }}") -gt "1" ]; then echo "uploadtoserver=true" >> $GITHUB_OUTPUT; fi | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- run: | | |
echo "baseurl: /${{ steps.prepare.outputs.prid }}" >> _config.yml | |
- name: Build the site with Jekyll | |
run: nix build | |
- name: Upload preview | |
run: | | |
mkdir -p "$HOME/.ssh" | |
echo "${{ secrets.KEY }}" > "$HOME/.ssh/key" | |
chmod 600 "$HOME/.ssh/key" | |
rsync -rILvh -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no" $GITHUB_WORKSPACE/result/ "${{ secrets.USERNAME }}@delta.chat:/var/www/html/staging/${{ steps.prepare.outputs.prid }}/" | |
- name: "Post links to details" | |
id: details | |
if: steps.prepare.outputs.uploadtoserver | |
run: | | |
# URLs for API connection and uploads | |
export GITHUB_API_URL="https://api.github.com/repos/deltachat/deltachat-pages/statuses/${{ github.event.after }}" | |
export PREVIEW_LINK="https://staging.delta.chat/${{ steps.prepare.outputs.prid }}/en/" | |
# Post AppImage download link to check details | |
export STATUS_DATA="{\"state\": \"success\", \ | |
\"description\": \"Preview the page here:\", \ | |
\"context\": \"Page Preview\", \ | |
\"target_url\": \"${PREVIEW_LINK}\"}" | |
curl -X POST --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" --url "$GITHUB_API_URL" --header "content-type: application/json" --data "$STATUS_DATA" | |
#check if comment already exists, if not post it | |
export GITHUB_API_URL="https://api.github.com/repos/deltachat/deltachat-pages/issues/${{ steps.prepare.outputs.prid }}/comments" | |
export RESPONSE=$(curl -L --header "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" --url "$GITHUB_API_URL" --header "content-type: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28") | |
echo $RESPONSE > response | |
grep -v '"Check out the page preview at https://staging.delta.chat/' response && echo "comment=true" >> $GITHUB_OUTPUT || true | |
- name: "Post link to comments" | |
if: steps.details.outputs.comment | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "Check out the page preview at https://staging.delta.chat/${{ steps.prepare.outputs.prid }}/en/" | |
}) |