Skip to content

Commit

Permalink
add gh actions to build image
Browse files Browse the repository at this point in the history
  • Loading branch information
oussamarouabah committed May 14, 2024
1 parent 4dee4c5 commit bfe9ba4
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 128 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/Greetings.yaml

This file was deleted.

72 changes: 0 additions & 72 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

25 changes: 7 additions & 18 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,20 @@ on:
branches: [ main ]

jobs:

build:
name: Build
name: Build & Test
runs-on: ubuntu-latest
steps:

- name: Set up Go 1.x
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ^1.13
id: go

go-version-file: 'go.mod'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Get dependencies
run: |
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
run: go mod download
- name: Test
run: go test -v ./...
- name: Build
run: cd cmd/storage-check && go build -v

- name: Test
run: cd cmd/storage-check && go test -v
24 changes: 0 additions & 24 deletions .github/workflows/gosec-checks.yaml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build & Release Image
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Get Code
uses: actions/checkout@v4

- name: Setup go environment
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Download dependencies
run: go mod download
- name: Run tests
run: go test -v ./...
build:
needs: test
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Get Code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set environment variables
run: |
RELEASE_VERSION=${GITHUB_REF#refs/tags/}
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
echo "IMG=ghcr.io/thg-ice/kuberhealthy-storage-check:${RELEASE_VERSION}" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ env.IMG }}
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# TODO move docker build step to a github action and push it to our internal registry
FROM golang:1.13 AS builder
WORKDIR /build
COPY go.* /build/
Expand Down

0 comments on commit bfe9ba4

Please sign in to comment.