fluidd

Форк
0
142 строки · 3.5 Кб
1
name: BUILD
2

3
on:
4
  push:
5
    branches:
6
      - develop
7
      - master
8
    tags:
9
      - 'v*'
10
  pull_request:
11
    branches:
12
      - develop
13
      - master
14

15
jobs:
16
  build:
17
    name: Build
18
    runs-on: ubuntu-latest
19
    steps:
20
      - name: Checkout
21
        uses: actions/checkout@v4
22

23
      - name: Setup Node
24
        uses: actions/setup-node@v4
25
        with:
26
          node-version: 20
27
          cache: 'npm'
28

29
      - name: Install dependencies
30
        run: |
31
          npm ci
32

33
      - name: Run lint
34
        run: |
35
          npm run lint -- --no-fix
36

37
      - name: Run tests
38
        run: |
39
          npm run test:unit
40

41
      - name: Run circular references check
42
        run: |
43
          npm run circular-check
44

45
      - name: Build
46
        run: |
47
          npm run build
48

49
      - name: Upload fluidd.zip
50
        uses: actions/upload-artifact@v4
51
        with:
52
          name: fluidd-${{ github.sha }}.zip
53
          path: ./dist
54

55
  publish-docker:
56
    name: Publish Docker Image
57
    needs: build
58
    if: ${{ github.event_name != 'pull_request' }}
59
    runs-on: ubuntu-latest
60
    steps:
61
      - name: Checkout
62
        uses: actions/checkout@v4
63

64
      - name: Download fluidd.zip
65
        uses: actions/download-artifact@v4
66
        with:
67
          name: fluidd-${{ github.sha }}.zip
68
          path: ./dist
69

70
      - name: Prepare Docker image metadata
71
        id: docker_meta
72
        uses: docker/metadata-action@v5
73
        with:
74
          images: |
75
            ghcr.io/${{ github.repository }}
76
          tags: |
77
            type=semver,pattern={{raw}}
78
            type=ref,event=pr
79
            type=sha,format=long
80
            type=raw,value=latest-develop,enable=${{ github.ref == 'refs/heads/develop' }}
81
            type=raw,value=latest-master,enable=${{ github.ref == 'refs/heads/master' }}
82

83
      - name: Set up QEMU
84
        uses: docker/setup-qemu-action@v3
85

86
      - name: Set up Docker Buildx
87
        uses: docker/setup-buildx-action@v3
88

89
      - name: Log in to the Container registry
90
        uses: docker/login-action@v3
91
        with:
92
          registry: ghcr.io
93
          username: ${{ github.actor }}
94
          password: ${{ secrets.GITHUB_TOKEN }}
95

96
      - name: Build and push Docker image
97
        uses: docker/build-push-action@v5
98
        with:
99
          context: .
100
          file: ./Dockerfile
101
          platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
102
          push: true
103
          tags: ${{ steps.docker_meta.outputs.tags }}
104
          labels: ${{ steps.docker_meta.outputs.labels }}
105

106
  publish-web:
107
    name: Deploy to Host
108
    needs: build
109
    if: ${{ github.ref == 'refs/heads/develop' }}
110
    runs-on: ubuntu-latest
111
    permissions:
112
      id-token: write
113
      contents: read
114
    steps:
115
      - name: Checkout
116
        uses: actions/checkout@v4
117

118
      - name: Download fluidd.zip
119
        uses: actions/download-artifact@v4
120
        with:
121
          name: fluidd-${{ github.sha }}.zip
122
          path: ./dist
123

124
      - name: Prepare Deploy
125
        run: |
126
          cp ./server/config.json ./dist/config.json
127

128
      - uses: aws-actions/configure-aws-credentials@v4
129
        with:
130
          aws-region: us-east-1
131
          role-to-assume: ${{ secrets.AWS_GITHUB_ACTIONS_ROLE }}
132

133
      - name: Deploy to Host
134
        uses: reggionick/s3-deploy@v4
135
        with:
136
          folder: dist
137
          bucket: ${{ secrets.DEV_S3_BUCKET_NAME }}
138
          bucket-region: us-east-1
139
          dist-id: ${{ secrets.DEV_CF_DISTRIBUTION_ID }}
140
          delete-removed: true
141
          no-cache: true
142
          private: true
143

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.