Skip to content

Commit

Permalink
58: introducing yamlfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jac18281828 committed Feb 9, 2024
1 parent 200068d commit 68057aa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 38 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/ci-image.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Build Dev Image CI

on:
workflow_dispatch:
pull_request:
Expand All @@ -8,19 +7,15 @@ on:
push:
branches:
- "*"

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build CI
uses: docker/build-push-action@v3
Expand All @@ -31,4 +26,3 @@ jobs:
build-args: |
VERSION=latest
CARGO_INCREMENTAL=0
26 changes: 7 additions & 19 deletions .github/workflows/ghcr-image.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,44 @@
name: Docker Image Build Push

on:
push:
tags:
- "*"

concurrency:
group: "docker-image"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Generate repository name
run: |
echo "REPOSITORY_PATH=$( echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]' )" >> ${GITHUB_ENV}
echo "REPOSITORY_SHA=$( echo ${GITHUB_SHA} | cut -c 1-8 )" >> ${GITHUB_ENV}
-
name: Login to GitHub Container Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and Push
- name: Build and Push
uses: docker/build-push-action@v3
with:
context: .
file: ./prod/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
build-args: |
VERSION=${{ github.ref_name }}
CARGO_INCREMENTAL=0
build-args: "VERSION=${{ github.ref_name }}\nCARGO_INCREMENTAL=0 \n"
tags: |
ghcr.io/${{ env.REPOSITORY_PATH }}:v${{ github.ref_name }}
ghcr.io/${{ env.REPOSITORY_PATH }}:${{ env.REPOSITORY_SHA }}
ghcr.io/${{ env.REPOSITORY_PATH }}:latest
-
name: GitHub Release
- name: GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/prod-ci-image.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: Build Prod Image CI

on:
workflow_dispatch:
pull_request:
Expand All @@ -8,28 +7,23 @@ on:
push:
branches:
- "*"

jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
- name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Prod Image CI
uses: docker/build-push-action@v3
with:
context: .
file: prod/Dockerfile
file: prod/Dockerfile
platforms: linux/amd64
push: false
build-args: |
VERSION=latest
CARGO_INCREMENTAL=0
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ COPY --chown=xmtp:xmtp . .
ENV PATH=~${USER}/.cargo/bin:$PATH
ENV USER=xmtp

RUN yamlfmt -lint .github/workflows/*.yml

ENV CARGO_INCREMENTAL=${CARGO_INCREMENTAL:-1}
RUN cargo check
RUN cargo fmt --check
Expand Down

0 comments on commit 68057aa

Please sign in to comment.