test-env/.gitea/workflows/build-publish.yaml

48 lines
1.5 KiB
YAML

name: ci
on:
push:
branches: [ main ]
jobs:
docker:
strategy:
matrix:
arch: ['ubuntu-latest', 'arm-ubuntu-latest']
go-version: ['1.19','1.20']
git-version: ['2.40.0']
golangci-lint-version: ['1.52.2']
runs-on: ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3
- name: generate docker tag
run: |
if [ "${{ matrix.arch }}" == "ubuntu-latest" ]; then
echo ::set-output name=value::amd64
else
echo ::set-output name=value::arm64
fi
id: arch
- name: setup buildx
uses: https://github.com/docker/setup-buildx-action@v2
- name: login into docker hub
run: |
BASE64_AUTH=`echo -n "$CI_REGISTRY_USER:$CI_REGISTRY_PASSWORD" | base64 -w 0`
mkdir -p ~/.docker
echo "{\"auths\": {\"$CI_REGISTRY\": {\"auth\": \"$BASE64_AUTH\"}}}" > ~/.docker/config.json
env:
CI_REGISTRY: https://index.docker.io/v1/
CI_REGISTRY_USER: ${{ secrets.DOCKER_USERNAME }}
CI_REGISTRY_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: build image
uses: https://github.com/docker/build-push-action@v4
env:
ACTIONS_RUNTIME_TOKEN: ''
with:
push: true
tags: gitea/test_env:linux-${{ matrix.go-version }}-${{ steps.arch.outputs.value }}
build-args: |
GOLANG_VERSION=${{ matrix.go-version }}
GIT_VERSION=${{ matrix.git-version }}
GOLANGCI_LINT_VERSION=${{ matrix.golangci-lint-version }}