ci: Release workflow updates for Dockerfile and changelog generation
This commit is contained in:
parent
3beed131a8
commit
d8580bf90f
@ -7,32 +7,82 @@ on:
|
|||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changelog:
|
build-and-push-container:
|
||||||
name: Generate changelog
|
name: Build Container
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Docker meta
|
||||||
uses: actions/checkout@v4
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
images: |
|
||||||
|
git.dev-null.rocks/alexohneander/gosearch
|
||||||
|
tags: |
|
||||||
|
type=schedule,pattern={{date 'YYYYMMDDHHMM'}}
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
|
type=sha
|
||||||
|
|
||||||
- name: Generate changelog
|
- name: Set up Docker Context for Buildx
|
||||||
uses: orhun/git-cliff-action@v4
|
id: buildx-context
|
||||||
with:
|
|
||||||
config: cliff.toml
|
|
||||||
args: --verbose
|
|
||||||
env:
|
|
||||||
OUTPUT: CHANGELOG.md
|
|
||||||
GITHUB_REPO: ${{ github.repository }}
|
|
||||||
|
|
||||||
- name: Commit
|
|
||||||
run: |
|
run: |
|
||||||
git checkout <branch>
|
export DOCKER_HOST=tcp://docker:2376/
|
||||||
git config user.name 'github-actions[bot]'
|
export DOCKER_TLS_CERTDIR="/certs"
|
||||||
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
export DOCKER_TLS_VERIFY=1
|
||||||
set +e
|
export DOCKER_CERT_PATH="/certs/client"
|
||||||
git add CHANGELOG.md
|
docker context create builders
|
||||||
git commit -m "Update changelog"
|
|
||||||
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git <branch>
|
- name: Setup Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
# buildkitd-flags: --debug
|
||||||
|
endpoint: builders
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: "tcp://docker:2376/"
|
||||||
|
DOCKER_TLS_CERTDIR: "/certs"
|
||||||
|
DOCKER_TLS_VERIFY: 1
|
||||||
|
DOCKER_CERT_PATH: "/certs/client"
|
||||||
|
|
||||||
|
- name: Login to Gitea
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.dev-null.rocks
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
password: ${{ secrets.GA_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push the image
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
file: Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
env:
|
||||||
|
DOCKER_HOST: "tcp://docker:2376/"
|
||||||
|
DOCKER_TLS_CERTDIR: "/certs"
|
||||||
|
DOCKER_TLS_VERIFY: 1
|
||||||
|
DOCKER_CERT_PATH: "/certs/client"
|
||||||
|
|
||||||
|
# - name: Generate changelog
|
||||||
|
# uses: orhun/git-cliff-action@v4
|
||||||
|
# with:
|
||||||
|
# config: cliff.toml
|
||||||
|
# args: --verbose
|
||||||
|
# env:
|
||||||
|
# OUTPUT: CHANGELOG.md
|
||||||
|
# GITHUB_REPO: ${{ github.repository }}
|
||||||
|
|
||||||
|
# - name: Commit
|
||||||
|
# run: |
|
||||||
|
# git checkout <branch>
|
||||||
|
# git config user.name 'github-actions[bot]'
|
||||||
|
# git config user.email 'github-actions[bot]@users.noreply.github.com'
|
||||||
|
# set +e
|
||||||
|
# git add CHANGELOG.md
|
||||||
|
# git commit -m "Update changelog"
|
||||||
|
# git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git <branch>
|
22
Dockerfile
Normal file
22
Dockerfile
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Use the official Golang image for building
|
||||||
|
FROM golang:1.23 AS builder
|
||||||
|
# Set working directory
|
||||||
|
WORKDIR /app
|
||||||
|
# Copy Go modules and dependencies
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
# Copy source code
|
||||||
|
COPY . .
|
||||||
|
# Build the application
|
||||||
|
RUN go build -o gosearch .
|
||||||
|
|
||||||
|
# Use a minimal base image for final deployment
|
||||||
|
FROM alpine:latest
|
||||||
|
# Set working directory in the container
|
||||||
|
WORKDIR /root/
|
||||||
|
# Copy the built binary from the builder stage
|
||||||
|
COPY --from=builder /app/gosearch .
|
||||||
|
# Expose the application port
|
||||||
|
EXPOSE 3000
|
||||||
|
# Run the application
|
||||||
|
CMD ["./gosearch"]
|
Loading…
x
Reference in New Issue
Block a user