feat(ci): set up automated deploys to fly.io
This commit is contained in:
parent
c0022f2d0d
commit
3c53a0be66
|
@ -0,0 +1,47 @@
|
|||
name: Deploy to fly.io
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
|
||||
env:
|
||||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
name: Deploy app
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # v3
|
||||
|
||||
- name: Set up flyctl
|
||||
uses: superfly/flyctl-actions/setup-flyctl@master
|
||||
|
||||
- name: Install Nix
|
||||
uses: cachix/install-nix-action@daddc62a2e67d1decb56e028c9fa68344b9b7c2a # tag=v18
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
extra_nix_config:
|
||||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Cachix (msfjarvis)
|
||||
uses: cachix/cachix-action@6a9a34cdd93d0ae4b4b59fd678660efb08109f2f # tag=v12
|
||||
with:
|
||||
name: msfjarvis
|
||||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||
cachixArgs: -c9 --omit-deriver
|
||||
|
||||
- name: Build and load container image
|
||||
shell: bash
|
||||
run: |
|
||||
nix build .#container
|
||||
docker load < result
|
||||
|
||||
- name: Publish image and deploy
|
||||
shell: bash
|
||||
run: |
|
||||
fly docker auth
|
||||
docker push registry.fly.io/linkleaner:latest-x86_64-linux
|
||||
fly deploy
|
Loading…
Reference in New Issue