Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
60 lines (56 sloc) 2 KB
---
name: deploy
on: deployment
jobs:
deploy:
runs-on: ubuntu-latest
steps:
-
run: |
statuses_url="$(jq -r .deployment.statuses_url < ${GITHUB_EVENT_PATH})"
payload="$(echo '{}' | jq --arg state in_progress --arg description 'started deploy' '.state = $state | .description = $description')"
curl -sS -XPOST \
-d "${payload}" \
-H 'accept: application/vnd.github.flash-preview+json' \
-H 'authorization: bearer ${{ secrets.GITHUB_TOKEN }}' \
"${statuses_url}"
-
uses: actions/checkout@v1
-
uses: actions/setup-node@v1
with:
node-version: '12.x'
-
run: yarn install --frozen-lockfile
-
name: run deploy
run: |
mkdir -p functions/lib
echo "$GITHUB_SHA" > functions/lib/VERSION
cat "${GITHUB_EVENT_PATH}" | jq .deployment.payload > functions/lib/payload.json
cat functions/lib/payload.json
yarn firebase --project "${{ secrets.FIREBASE_PROJECT }}" --token "${{ secrets.FIREBASE_TOKEN }}" deploy
-
name: record deployment status
if: always()
run: |
job_status="$(echo ${{ job.status }} | tr '[:upper:]' '[:lower:]')"
echo job.status=${job_status}
deployment_state='error'
case "$job_status" in
success)
deployment_state='success'
;;
failure)
deployment_state='failure'
;;
*)
;;
esac
statuses_url=$(jq -r .deployment.statuses_url < ${GITHUB_EVENT_PATH})
payload="$(echo '{}' | jq --arg state ${deployment_state} --arg description 'finished deploy' '.state = $state | .description = $description')"
curl -sS -XPOST \
-d "${payload}" \
-H 'accept: application/vnd.github.flash-preview+json' \
-H 'authorization: bearer ${{ secrets.GITHUB_TOKEN }}' \
"${statuses_url}"
You can’t perform that action at this time.