forked from windmill-labs/windmill
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (65 loc) · 2.47 KB
/
build_push_image.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
name: Build and push Docker image
on: workflow_dispatch
jobs:
build-push-docker-image:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate version
run: echo "VERSION=$(date +'%Y.%m.%d')-$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: sa-east-1
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
- name: Setup Cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
backend/target/
/usr/local/cargo/registry
key: ${{ runner.os }}-cargo-${{ hashFiles('backend/Cargo.lock') }}
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- name: Setup npm cache
uses: actions/cache@v3
env:
DIR: ${{ env.dir }}
with:
path: ${DIR}
key: ${{ runner.os }}-node-${{ hashFiles('frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup Docker build cache
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-docker-buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
env:
VERSION: ${{ env.VERSION }}
REPO: 859499744640.dkr.ecr.sa-east-1.amazonaws.com
CACHE: /tmp/.buildx-cache
run: |
docker buildx build --cache-from type=local,src=${CACHE} --cache-to type=local,dest=${CACHE} --platform linux/amd64 -t ${REPO}/windmill:latest -t ${REPO}/windmill:${VERSION} --push .
- name: Replace tag version
run: sed -i 's/TAG_VERSION/${{ env.VERSION }}/g' jobfiles/windmill.hcl
- name: Pack
run: zip -r -j windmill.${{ env.VERSION }}.zip jobfiles/windmill.hcl
- name: Create draft release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create --draft windmill/${{ env.VERSION }} windmill.${{ env.VERSION }}.zip