-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (79 loc) · 2.6 KB
/
deploy.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Deploy
on:
push:
branches:
- "main"
tags:
- "v*.*.*"
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip-ci]')"
env:
LOG_LEVEL: "info"
LOGTAIL_TOKEN: "${{ secrets.LOGTAIL_TOKEN }}"
LOGTAIL_TOKEN_DOCKER: "${{ secrets.LOGTAIL_TOKEN_DOCKER }}"
NODE_ENV: "production"
REGISTRY: "ghcr.io"
SENTRY_AUTH_TOKEN: "${{ secrets.SENTRY_AUTH_TOKEN }}"
SENTRY_DSN: "${{ secrets.SENTRY_DSN }}"
SENTRY_ORG: "${{ secrets.SENTRY_ORG }}"
SENTRY_PROJECT: "${{ secrets.SENTRY_PROJECT }}"
TEST_TAG: "${{ github.repository }}:test-${{ github.sha }}"
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
with:
platforms: arm64
- uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v4
id: meta
with:
images: |
${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v4
with:
context: .
load: true
platforms: linux/amd64
tags: ${{ env.TEST_TAG }}
- run: docker run --detach --env PORT_SERVER=8081 --env LOGTAIL_TOKEN_DOCKER=${{ env.LOGTAIL_TOKEN_DOCKER }} --interactive --rm --tty ${{ env.TEST_TAG }} | xargs echo stdout= | tr -d '[:space:]' >> $GITHUB_OUTPUT
id: docker-run
- run: sleep 15s
shell: bash
- run: docker stop ${{ steps.docker-run.outputs.stdout }}
- run: docker rmi ${{ env.TEST_TAG }}
- uses: docker/build-push-action@v4
with:
context: .
labels: ${{ steps.meta.outputs.labels }}
platforms: |
linux/amd64
# linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
- uses: ruby/setup-ruby@v1
if: github.ref_type == 'tag'
with:
bundler-cache: true
ruby-version: "3.2"
- run: kamal deploy --skip-push --version ghcr.io/${{ github.repository }}:${{ github.ref_name }}
if: github.ref_type == 'tag'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}