Skip to content

Commit

Permalink
Merge pull request #2 from wiley/update-gh-action
Browse files Browse the repository at this point in the history
Update GH Action workflow
  • Loading branch information
cmartintlh authored Jan 22, 2024
2 parents 1bd6cb7 + 93d2eaa commit 5e9e6f7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 18 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Container Build
on:
workflow_dispatch:
push:
branches: [ "main" ]
branches:
- '**'
tags:
- 'v*.*.*'
pull_request:
branches: [ "main" ]

Expand All @@ -19,14 +22,35 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/wiley/deadmanswatch
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Login
uses: docker/login-action@v2.1.0
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${{ env.REGISTRY }}/${{ github.repository }}:$(date -u +%Y-%m-%d)
- name: Push the Docker image
run: docker push ${{ env.REGISTRY }}/${{ github.repository }}:$(date -u +%Y-%m-%d)

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' && github.event_name != 'pull_request_target' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ LABEL maintainer="cmartin@wiley.com" \
RUN useradd -u 10001 deadmanswatch

# Copy the code from the host and compile it
WORKDIR $GOPATH/src/github.com/KierranM/deadmanswatch
COPY ./go.mod ./go.sum $GOPATH/src/github.com/KierranM/deadmanswatch/
COPY ./main.go $GOPATH/src/github.com/KierranM/deadmanswatch/main.go
COPY ./cmd $GOPATH/src/github.com/KierranM/deadmanswatch/cmd
WORKDIR $GOPATH/src/github.com/wiley/deadmanswatch
COPY ./go.mod ./go.sum $GOPATH/src/github.com/wiley/deadmanswatch/
COPY ./main.go $GOPATH/src/github.com/wiley/deadmanswatch/main.go
COPY ./cmd $GOPATH/src/github.com/wiley/deadmanswatch/cmd
RUN go get
RUN go test ./...
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix nocgo -o /deadmanswatch .
Expand Down
6 changes: 3 additions & 3 deletions deploy/helm/deadmanswatch/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ appVersion: "1.0.1"
description: A Helm chart for deploying DeadMansWatch
name: deadmanswatch
version: 1.0.0
home: https://github.com/kierranm/deadmanswatch
home: https://github.com/wiley/deadmanswatch
engine: gotpl
maintainers:
- name: kierranm
email: kierranm@gmail.com
- name: cmartin
email: cmartin@wiley.com
keywords:
- deadmanswitch
- alertmanager
Expand Down
5 changes: 2 additions & 3 deletions deploy/kubes/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: deadmanswatch
image: "kierranm/deadmanswatch:v1.0.0"
image: "ghcr.io/wiley/deadmanswatch:v1.0.0"
imagePullPolicy: IfNotPresent
args:
- watch
Expand All @@ -31,5 +31,4 @@ spec:
httpGet:
path: /ping
port: http
resources:
{}
resources: {}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/KierranM/deadmanswatch
module github.com/wiley/deadmanswatch

go 1.21

Expand Down

0 comments on commit 5e9e6f7

Please sign in to comment.