-
Notifications
You must be signed in to change notification settings - Fork 7
89 lines (76 loc) · 2.82 KB
/
web-release.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
82
83
84
85
86
87
88
89
name: Web Release
on:
push:
branches:
- main
paths:
- "apps/web-remix/**"
release:
types: [published]
defaults:
run:
working-directory: apps/web-remix
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 8.15.3
- uses: actions/setup-node@v4
with:
node-version: "21.6.2"
cache: "pnpm"
cache-dependency-path: apps/web-remix/pnpm-lock.yaml
- run: pnpm install
- run: pnpm lint
- run: pnpm test
- run: pnpm build
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
if: ${{ github.event_name == 'push' }}
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.BUILDEL_WEB__FLY_API_TOKEN }}
if: ${{ github.event_name == 'push' }}
docker:
name: Docker
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Set up tags
id: set-tags
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "tags=ghcr.io/${{ github.repository }}/web-remix:${{ github.sha }},ghcr.io/${{ github.repository }}/web-remix:alpha" >> $GITHUB_ENV
fi
if [ "${{ github.event_name }}" == "release" ]; then
is_latest=$(gh api repos/${{ github.repository }}/releases/latest | jq -r '.tag_name == "${{ github.event.release.tag_name }}"')
if [ "$is_latest" == "true" ]; then
echo "tags=ghcr.io/${{ github.repository }}/web-remix:${{ github.sha }},ghcr.io/${{ github.repository }}/web-remix:${{ github.event.release.tag_name }},ghcr.io/${{ github.repository }}/web-remix:latest" >> $GITHUB_ENV
else
echo "tags=ghcr.io/${{ github.repository }}/web-remix:${{ github.sha }},ghcr.io/${{ github.repository }}/web-remix:${{ github.event.release.tag_name }}" >> $GITHUB_ENV
fi
fi
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: apps/web-remix
tags: ${{ env.tags }}
push: ${{ github.event_name == 'push' || github.event_name == 'release' }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/web-remix:alpha-cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/web-remix:alpha-cache,mode=max