mirror of
https://github.com/nais/wonderwall.git
synced 2026-08-19 02:56:15 +00:00
use ci
This commit is contained in:
@@ -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 }}
|
||||
@@ -0,0 +1 @@
|
||||
bin/
|
||||
@@ -0,0 +1,9 @@
|
||||
apiVersion: nais.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: wonderwall
|
||||
namespace: aura
|
||||
labels:
|
||||
team: aura
|
||||
spec:
|
||||
image: {{ image }}
|
||||
+15
@@ -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"]
|
||||
@@ -1 +1,4 @@
|
||||
# wonderwall
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -1 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("Sleeping for a while")
|
||||
time.Sleep(time.Hour * 12)
|
||||
}
|
||||
|
||||
Executable
+7
@@ -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}
|
||||
Reference in New Issue
Block a user