-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chi and Templ implementation Docker image build and push workflow
- Loading branch information
Showing
56 changed files
with
701 additions
and
805 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
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,48 @@ | ||
name: Docker image | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Install yq | ||
run: | | ||
sudo wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq | ||
sudo chmod +x /usr/bin/yq | ||
- name: Run docker tag sh and export var from config.yml | ||
run: | | ||
chmod +x ./docker_tag.sh | ||
./docker_tag.sh | ||
- name: Export env variabels | ||
uses: cardinalby/export-env-action@v2 | ||
with: | ||
envFile: '.env' | ||
|
||
- name: Build and push | ||
if: ${{ env.PUSH_TO_DOCKER == 'true' }} | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ env.DOCKER_HUB_USERNAME }}/${{ env.DOCKER_REPO_NAME }}:${{ env.NEW_TAG }} | ||
target: prod |
This file was deleted.
Oops, something went wrong.
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,35 @@ | ||
name: goreleaser | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.22.0' | ||
|
||
- name: Install dependencies | ||
run: | | ||
go install github.com/a-h/templ/cmd/templ@latest | ||
templ generate | ||
- name: Run GoReleaser | ||
uses: goreleaser/[email protected] | ||
with: | ||
distribution: goreleaser | ||
version: ${{ env.GITHUB_REF_NAME }} | ||
args: release --clean | ||
workdir: ./ | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
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 |
---|---|---|
@@ -1,29 +1,23 @@ | ||
name: Linting | ||
name: continuous integration | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**.go' | ||
- go.sum | ||
- go.mod | ||
branches-ignore: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: '1.22.1' | ||
go-version: '1.22.2' | ||
|
||
- name: Deps cache | ||
id: cache-go-deps | ||
uses: actions/cache@v3 | ||
uses: actions/cache@v4 | ||
env: | ||
cache-name: go-deps-cache | ||
with: | ||
|
@@ -33,14 +27,17 @@ jobs: | |
${{ runner.os }}-build-${{ env.cache-name }}- | ||
- if: ${{ steps.cache-go-deps.outputs.cache-hit != 'true' }} | ||
name: List the state of node modules | ||
name: List the state of go modules | ||
continue-on-error: true | ||
run: go mod graph | ||
|
||
- name: Install dependencies | ||
run: | | ||
go mod tidy | ||
go mod download | ||
go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
go install github.com/a-h/templ/cmd/templ@latest | ||
templ generate | ||
- name: Run golangci-lint | ||
uses: golangci/golangci-lint[email protected] | ||
run: golangci-lint run |
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
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,42 @@ | ||
before: | ||
hooks: | ||
- go mod tidy | ||
|
||
env: | ||
- PACKAGE_PATH=github.com/ujstor/portfolio-web/cmd | ||
|
||
builds: | ||
- binary: "{{ .ProjectName }}" | ||
main: ./cmd/api | ||
goos: | ||
- darwin | ||
- linux | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
env: | ||
- CGO_ENABLED=0 | ||
ldflags: | ||
- -s -w -X {{.Env.PACKAGE_PATH}}={{.Version}} | ||
release: | ||
prerelease: auto | ||
|
||
universal_binaries: | ||
- replace: true | ||
|
||
archives: | ||
- name_template: > | ||
{{- .ProjectName }}_{{- .Version }}_{{- title .Os }}_{{- if eq .Arch "amd64" }}x86_64{{- else if eq .Arch "386" }}i386{{- else }}{{ .Arch }}{{ end }}{{- if .Arm }}v{{ .Arm }}{{ end -}} | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
builds_info: | ||
group: root | ||
owner: root | ||
files: | ||
- README.md | ||
checksum: | ||
name_template: 'checksums.txt' | ||
|
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.