-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (47 loc) · 1.86 KB
/
deploy-live.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Deploy Production
env:
REPO_NAME: ${{ github.event.repository.name }}
REPO_OWNER: ${{ github.repository_owner }}
on:
workflow_dispatch:
release:
types: [created]
jobs:
build_and_tag:
runs-on: ubuntu-latest
environment: Production
services:
docker:
image: docker:19.03.5-dind
options: --privileged
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: live
- name: Build Docker image
run: |
export DATABASE_URL=${{ secrets.DATABASE_URL }}
export NEXTAUTH_SECRET=${{ secrets.NEXTAUTH_SECRET }}
export DISCORD_CLIENT_ID=${{ secrets.DISCORD_CLIENT_ID }}
export DISCORD_CLIENT_SECRET=${{ secrets.DISCORD_CLIENT_SECRET }}
export UPSTASH_REDIS_REST_URL=${{ secrets.UPSTASH_REDIS_REST_URL }}
export UPSTASH_REDIS_REST_TOKEN=${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
docker build -t in-house-queue-site .
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Log in to DigitalOcean Container Registry with short-lived credentials
run: doctl registry login --expiry-seconds 600
- name: Get the latest release tag
id: latest_release
run: |
tag=$(curl -s -H "Authorization: token ${{ secrets.GH_TOKEN }}" "https://api.github.com/repos/${{ env.REPO_OWNER }}/${{ env.REPO_NAME }}/releases/latest" | jq -r ".tag_name")
echo "TAG=$tag" >> $GITHUB_ENV
- name: Tag and push Docker image
run: |
export DO_REPOSITORY=${{ secrets.DO_REPO }}
TAG=${{ env.TAG }}
docker tag in-house-queue-site:latest $DO_REPOSITORY:$TAG
docker push $DO_REPOSITORY:$TAG