Skip to content

Commit

Permalink
ci: add build step in workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rsdmike committed Feb 9, 2024
1 parent 5bc7ad9 commit a51533f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@ name: Docker Image CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
docker_registry:
description: 'Registry URL'
required: true
default: 'docker.io/username'
image_name:
description: 'Name you wish to use on the docker image (ex. myapp). This will be tagged with :latest, and the git sha'
required: true
default: 'app'
permissions:
contents: read

Expand All @@ -21,21 +14,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit

- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.0.0
- name: Build the Docker image
run: docker build . --file Dockerfile --tag ${{ github.event.inputs.docker_registry }}/${{ github.event.inputs.image_name }}:latest --tag ${{ github.event.inputs.docker_registry }}/${{ github.event.inputs.image_name }}:${{ github.sha }}
run: docker build --file Dockerfile --tag vprodemo.azurecr.io/console:latest --tag vprodemo.azurecr.io/console:${{ github.sha }} .
- name: Docker Login
if: ${{ github.ref == 'refs/heads/main' }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ github.event.inputs.docker_registry }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
logout: true
- name: Push the Docker image to ${{ github.event.inputs.docker_registry }}
run: docker push ${{ github.event.inputs.docker_registry }}/${{ github.event.inputs.image_name }}
- name: Push the Docker image to ${{ github.event.inputs.docker_registry }}
run: docker push ${{ github.event.inputs.docker_registry }}/${{ github.event.inputs.image_name }}:${{ github.sha }}
- name: Push the Docker image to the registry
if: ${{ github.ref == 'refs/heads/main' }}
run: docker push vprodemo.azurecr.io/console:latest
- name: Push the Docker image to the registry
if: ${{ github.ref == 'refs/heads/main' }}
run: docker push vprodemo.azurecr.io/console:${{ github.sha }}
8 changes: 5 additions & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
with:
egress-policy: audit

Expand All @@ -53,14 +53,16 @@ jobs:
run: go vet ./...
if: ${{ matrix.os == 'ubuntu-20.04' }}
- name: Run go lint
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0
if: ${{ matrix.os == 'ubuntu-20.04' }}
with:
version: latest
- name: build go
run: go build ./cmd/main.go
- name: Go Fuzz
if: ${{ matrix.os == 'ubuntu-20.04' }}
run: go test ./cmd -fuzz=FuzzMe -fuzztime=15s
- uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1
- uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1
if: ${{ matrix.os == 'ubuntu-20.04' }}
name: Upload Coverage Results
- name: GitHub Upload Release Artifacts
Expand Down

0 comments on commit a51533f

Please sign in to comment.