This commit is contained in:
Kent Daleng
2021-08-17 13:57:06 +02:00
parent 1aec4cd36a
commit 18b9d43545
7 changed files with 81 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
name: Build wonderwall
on: [push]
env:
image_base: ghcr.io/${{ github.repository }}
jobs:
build-and-deploy:
name: Build, push and deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Docker login
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: docker login ghcr.io -u ${GITHUB_REPOSITORY} -p ${GITHUB_TOKEN}
- name: Set version
run: |
echo "VERSION=$(./version.sh)" >> $GITHUB_ENV
- name: Build Docker image
run: |
docker build . --tag ${image_base}:${{ env.VERSION }} --tag ${image_base}:latest
- name: Push versioned docker image
run: |
docker push ${image_base}:${{ env.VERSION }}
- name: Push latest docker image
if: github.ref == 'refs/heads/master'
run: docker push ${image_base}:latest
- uses: nais/deploy/actions/deploy@v1
if: github.ref == 'refs/heads/master'
env:
APIKEY: ${{ secrets.NAIS_DEPLOY_APIKEY }}
CLUSTER: dev-gcp
RESOURCE: .nais/nais.yml
VAR: image=${image_base}:${{ env.VERSION }}
+1
View File
@@ -0,0 +1 @@
bin/
+9
View File
@@ -0,0 +1,9 @@
apiVersion: nais.io/v1alpha1
kind: Application
metadata:
name: wonderwall
namespace: aura
labels:
team: aura
spec:
image: {{ image }}
+15
View File
@@ -0,0 +1,15 @@
FROM golang:1.16-alpine as builder
RUN apk add --no-cache git make curl
ENV GOOS=linux
ENV CGO_ENABLED=0
ENV GO111MODULE=on
COPY . /src
WORKDIR /src
RUN make test
RUN make alpine
FROM alpine:3
RUN export PATH=$PATH:/app
WORKDIR /app
COPY --from=builder /src/bin/wonderwall /app/wonderwall
ENTRYPOINT ["/app/wonderwall"]
+3
View File
@@ -1 +1,4 @@
# wonderwall
![anyway here's wonderwall](https://i.imgur.com/NhRLEej.png)
+10
View File
@@ -1 +1,11 @@
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println("Sleeping for a while")
time.Sleep(time.Hour * 12)
}
Executable
+7
View File
@@ -0,0 +1,7 @@
#!/bin/sh
dirty=""
test -z "$(git ls-files --exclude-standard --others)"
if [ $? -ne 0 ]; then
dirty="-dirty"
fi
echo $(date "+%Y-%m-%d")-$(git --no-pager log -1 --pretty=%h)${dirty}