Skip to content

first commit

first commit #6

Workflow file for this run

name: Consul plugin CI
on: [push]
env:
GOLANG_VERSION: '1.21'
jobs:
init-variable:
runs-on: ubuntu-latest
outputs:
container_tag: ${{ steps.init_variable.outputs.container_tag }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: output environment variable
id: init_variable
run: |
echo container_tag=$(git describe --tags --abbrev=8) >> $GITHUB_OUTPUT
unit-tests:
name: Unit tests running
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Checkout code
uses: actions/checkout@v4
- name: Unit tests running
run: |
go test -v ./...
linting:
name: Go code linting
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Checkout code
uses: actions/checkout@v4
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
args: --verbose --timeout 6m
build:
name: Build creation
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GOLANG_VERSION }}
- name: Checkout code
uses: actions/checkout@v4
- name: Build creation
run: |
make build
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build image tag
run: echo "IMAGE_TAG=$(cat ./VERSION)-${GITHUB_SHA::8}" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.GH_PAT }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/arm
push: true
tags: |
ghcr.io/argoproj-labs/rollouts-plugins-trafficrouter-consul:latest
ghcr.io/argoproj-labs/rollouts-plugins-trafficrouter-consul:${{ env.IMAGE_TAG }}
file: ./Dockerfile
build-args: |
IMAGE_TAG=${{ env.IMAGE_TAG }}