Skip to content

Deploy

Deploy #22

Workflow file for this run

# The default GitHub runner image comes with a bunch of software preinstalled.
# Typically this doesn't matter, however with Cargo it appears to interfere,
# hence the `rm -rf ~/.cargo/` steps.
name: Deploy
on:
workflow_run:
workflows: Check
branches: master
types: completed
jobs:
deploy:
name: Deploy
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v21
# Docker is preinstalled.
- run: nix build .#dockerImage && ./result | docker load
- run: |
echo ${{ secrets.FLY_AUTH_TOKEN }} | docker login -u x --password-stdin registry.fly.io/mercury-test
docker tag mercury registry.fly.io/mercury-test:latest
docker push registry.fly.io/mercury-test:latest
- run: nix develop .#ops -c flyctl deploy -t ${{ secrets.FLY_AUTH_TOKEN }}
# This (emphasis on `--fail-with-body`) acts as a sort of final E2E test.
- run: |
curl https://mercury-test.fly.dev/api/v1/slack --fail-with-body -X POST \
--oauth2-bearer '${{ secrets.MERCURY_SLACK_TOKEN }}' \
-d channel=playground \
-d title='🚀 Mercury' \
-d desc='A new deployment has succeeded.' \
-d link='${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
docs:
name: Publish docs
if: github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
pages: write
steps:
- uses: actions/checkout@v3
- run: rm -rf ~/.cargo/
- uses: cachix/install-nix-action@v21
- run: |
nix develop -c cargo doc --no-deps
echo '<meta http-equiv="refresh" content="0; url=mercury">' > ./target/doc/index.html
- uses: actions/upload-pages-artifact@v1
with:
path: ./target/doc/
- uses: actions/deploy-pages@v2