Skip to content

Merge pull request #7 from slashdevops/fix-test #2

Merge pull request #7 from slashdevops/fix-test

Merge pull request #7 from slashdevops/fix-test #2

Workflow file for this run

name: Main branch workflow
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
env:
DOCKER_HUB_REPO: "docker.io/slashdevops"
DOCKER_BUILD_ARCHS: "amd64"
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.22.4
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Install promu
run: make promu
- name: Build and Test Linux Platform Only
run: make
- name: Check code modifications
run: git diff --exit-code
build:
name: Build
needs: test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.22.4
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Install promu
run: make promu
- name: Build Cross-Platform
run: promu crossbuild -v
- name: List Workspace Files
run: ls -la .
- name: List .build Files
run: ls -la .build
- name: Upload .build artifacts
uses: actions/upload-artifact@v4
with:
name: .build
path: .build
publish_docker_images:
name: Publish Docker Images
needs: build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.22.4
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Install promu
run: make promu
- name: Docker Version
run: docker version
- name: Download .build artifacts from Build Step
uses: actions/download-artifact@v4
with:
name: .build
path: .build
- name: Assign Execution Permission to Binaries
run: chmod -R +x .build/*/*
- name: List Workspace Files
run: ls -la .
- name: List .build Files
run: ls -la .build
- name: Build Docker Images
run: make docker DOCKER_REPO=$DOCKER_HUB_REPO DOCKER_ARCHS=$DOCKER_BUILD_ARCHS
- name: Docker Tag Images Latest
run: make docker-tag-latest DOCKER_REPO=$DOCKER_HUB_REPO DOCKER_ARCHS=$DOCKER_BUILD_ARCHS
- name: Show Local Docker Images
run: docker images
- name: Loging in Docker Hub
run: echo ${{ secrets.DOCKER_HUB_PASSWORD }} | docker login -u ${{ secrets.DOCKER_HUB_USER }} --password-stdin
- name: Publish Images in Docker Hub
run: make docker-publish DOCKER_REPO=$DOCKER_HUB_REPO DOCKER_ARCHS=$DOCKER_BUILD_ARCHS
- name: Publish Manifest in Docker Hub
run: make docker-manifest DOCKER_REPO=$DOCKER_HUB_REPO DOCKER_ARCHS=$DOCKER_BUILD_ARCHS