|
4 | 4 | workflow_dispatch: |
5 | 5 | inputs: |
6 | 6 | tag: |
7 | | - description: 'tag for the Docker image' |
| 7 | + description: "tag for the Docker image" |
8 | 8 | required: true |
9 | | - default: 'latest' |
| 9 | + default: "latest" |
10 | 10 | push: |
11 | 11 | branches: |
12 | | - - 'main' |
| 12 | + - "main" |
13 | 13 | jobs: |
14 | 14 | define-matrix: |
15 | 15 | runs-on: ubuntu-latest |
@@ -50,31 +50,39 @@ jobs: |
50 | 50 | matrix: |
51 | 51 | build_target: ${{ fromJson(needs.define-matrix.outputs.build_targets) }} |
52 | 52 | steps: |
53 | | - - name: Checkout code |
54 | | - uses: actions/checkout@v4 |
55 | | - with: |
56 | | - fetch-depth: 0 |
57 | | - - name: Set up QEMU |
58 | | - uses: docker/setup-qemu-action@v3 |
59 | | - - name: Set up Docker Buildx |
60 | | - uses: docker/setup-buildx-action@v3 |
61 | | - - name: Login to ghcr.io |
62 | | - uses: docker/login-action@v3 |
63 | | - with: |
64 | | - registry: ghcr.io |
65 | | - username: ${{ github.repository_owner }} |
66 | | - password: ${{ secrets.GH_PAT }} |
67 | | - - name: Build and push image |
68 | | - run: | |
69 | | - echo "build_target=${{ matrix.build_target }}" |
70 | | - echo "tag=${{ needs.define-matrix.outputs.tag }}" |
71 | | - echo "tag_cn=${{ needs.define-matrix.outputs.tag_cn }}" |
72 | | - image_name=$(bash script/get_image_name.sh ${{ github.repository_owner }} "${{ matrix.build_target }}" "${{ needs.define-matrix.outputs.tag }}") |
73 | | - image_name_cn=$(bash script/get_image_name.sh ${{ github.repository_owner }} "${{ matrix.build_target }}" "${{ needs.define-matrix.outputs.tag_cn }}") |
74 | | - echo "image_name=$image_name" >> $GITHUB_OUTPUT |
75 | | - echo "image_name_cn=$image_name_cn" >> $GITHUB_OUTPUT |
76 | | - echo "building image $image_name" |
77 | | - is_cn="0" bash script/build_and_push_images.sh "${{ matrix.build_target }}" "$image_name" $is_cn |
78 | | - echo "building image $image_name_cn" |
79 | | - is_cn="1" bash script/build_and_push_images.sh "${{ matrix.build_target }}" "$image_name_cn" $is_cn |
80 | | - # TODO: generate runtime yaml and json |
| 53 | + - name: Checkout code |
| 54 | + uses: actions/checkout@v4 |
| 55 | + with: |
| 56 | + fetch-depth: 0 |
| 57 | + - name: Set up QEMU |
| 58 | + uses: docker/setup-qemu-action@v3 |
| 59 | + - name: Set up Docker Buildx |
| 60 | + uses: docker/setup-buildx-action@v3 |
| 61 | + - name: Login to ghcr.io |
| 62 | + uses: docker/login-action@v3 |
| 63 | + with: |
| 64 | + registry: ghcr.io |
| 65 | + username: ${{ github.repository_owner }} |
| 66 | + password: ${{ secrets.GH_PAT }} |
| 67 | + - name: Generate SQL |
| 68 | + run: | |
| 69 | + echo "build_target=${{ matrix.build_target }}" |
| 70 | + echo "tag=${{ needs.define-matrix.outputs.tag }}" |
| 71 | + echo "tag_cn=${{ needs.define-matrix.outputs.tag_cn }}" |
| 72 | + echo "image_name=$image_name" >> $GITHUB_OUTPUT |
| 73 | + echo "image_name_cn=$image_name_cn" >> $GITHUB_OUTPUT |
| 74 | + image_name=$(bash script/get_image_name.sh ${{ github.repository_owner }} "${{ matrix.build_target }}" "${{ needs.define-matrix.outputs.tag }}") |
| 75 | + image_name_cn=$(bash script/get_image_name.sh ${{ github.repository_owner }} "${{ matrix.build_target }}" "${{ needs.define-matrix.outputs.tag_cn }}") |
| 76 | + template_json=$(bash script/get_template_config_json.sh "${{ matrix.build_target }}") |
| 77 | + template_repo_json=$(bash script/get_template_repo_json.sh "${{ matrix.build_target }}") |
| 78 | + sql=$(bash script/generate_template_sql.sh $image_name $template_json $template_repo_json) |
| 79 | + # 保存 SQL 到文件 |
| 80 | + mkdir -p /sql/templates/ |
| 81 | + echo "$sql" > "/sql/templates/${{ matrix.build_target//\//_ }}.sql" |
| 82 | + - name: Build and push image |
| 83 | + run: | |
| 84 | + echo "building image $image_name" |
| 85 | + is_cn="0" bash script/build_and_push_images.sh "${{ matrix.build_target }}" "$image_name" $is_cn |
| 86 | + echo "building image $image_name_cn" |
| 87 | + is_cn="1" bash script/build_and_push_images.sh "${{ matrix.build_target }}" "$image_name_cn" $is_cn |
| 88 | + # TODO: generate runtime yaml and json |
0 commit comments