-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Build and Push Images | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+.[0-9]+ | ||
- v[0-9]+.[0-9]+.[0-9]+ | ||
- v[0-9]+.[0-9]+ | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
GO_VERSION: "1.22.5" | ||
|
||
jobs: | ||
build-and-push-frontend: | ||
name: Build and Push Frontend Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get branch names. | ||
id: branch-names | ||
uses: tj-actions/branch-names@v8 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Log in to DockerHub | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_TOKEN }} | ||
password: ${{ secrets.DOCKERHUB_PASSWD }} | ||
|
||
- name: Build and push frontend image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: projecthami/hami-webui-fe:${{ steps.branch-names.outputs.current_branch || steps.branch-names.outputs.tag }} | ||
|
||
golang-lint: | ||
name: Lint Go Code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Go environment | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Run golint | ||
uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.60 | ||
args: "--timeout=5m ./server/..." | ||
|
||
build-and-push-backend: | ||
name: Build and Push Backend Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
|
||
- name: Get branch names. | ||
id: branch-names | ||
uses: tj-actions/branch-names@v8 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Log in to DockerHub | ||
uses: docker/[email protected] | ||
with: | ||
username: ${{ secrets.DOCKERHUB_TOKEN }} | ||
password: ${{ secrets.DOCKERHUB_PASSWD }} | ||
|
||
- name: Build and push backend image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./server | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: projecthami/hami-webui-be:${{ steps.branch-names.outputs.current_branch || steps.branch-names.outputs.tag }} |