-
Notifications
You must be signed in to change notification settings - Fork 135
91 lines (70 loc) · 2.78 KB
/
ci.buld.yml
File metadata and controls
91 lines (70 loc) · 2.78 KB
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
90
91
name: Run tests and build
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
name: Install pnpm
with:
version: 10
run_install: false
- name: Install Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Test
run: pnpm test
continue-on-error: true
- name: Build
run: pnpm build
docker:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Setup environment variables
run: |
echo "IMAGE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
if [[ $IS_MAIN == 'true' ]]; then
echo "DOCKER_IMAGE=aisheets/sheets" >> $GITHUB_ENV
echo "PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_ENV
echo "IMAGE_TAG=dev" >> $GITHUB_ENV
elif [[ $IS_RELEASE == 'true' ]]; then
echo "DOCKER_IMAGE=aisheets/sheets" >> $GITHUB_ENV
echo "PLATFORMS=linux/amd64,linux/arm64" >> $GITHUB_ENV
else
echo "DOCKER_IMAGE=aisheets/sheets-dev" >> $GITHUB_ENV
echo "PLATFORMS=linux/amd64" >> $GITHUB_ENV
fi
env:
IS_RELEASE: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/stable' }}
IS_MAIN: ${{ github.ref == 'refs/heads/main' }}
- name: Login to Docker Hub
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push image
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
with:
platforms: ${{ env.PLATFORMS }}
tags: ${{ env.DOCKER_IMAGE }}:${{ env.IMAGE_TAG }}
labels: ${{ steps.meta.outputs.labels }}
push: true
- name: Push latest image
if: github.ref == 'refs/heads/stable'
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
with:
platforms: ${{ env.PLATFORMS }}
tags: ${{ env.DOCKER_IMAGE }}:latest
labels: ${{ steps.meta.outputs.labels }}
push: true