moth/.github/workflows/build+test.yml

70 lines
1.7 KiB
YAML
Raw Normal View History

2020-09-18 14:41:41 -06:00
name: Build/Test
on:
push:
branches:
- v3
- devel
2020-09-18 15:39:07 -06:00
- main
2020-09-18 14:41:41 -06:00
tags:
- 'v*.*.*'
2020-09-17 18:56:40 -06:00
jobs:
test-mothd:
name: Test mothd
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
2020-09-18 14:41:41 -06:00
go-version: 1.13
2020-09-17 18:56:40 -06:00
- name: Retrieve code
2020-09-18 14:41:41 -06:00
uses: actions/checkout@v2
2020-09-17 18:56:40 -06:00
- name: Test
run: go test ./...
2020-09-18 12:52:04 -06:00
2020-09-18 12:15:11 -06:00
publish:
2020-09-18 14:41:41 -06:00
name: Publish container images
2020-09-18 12:15:11 -06:00
runs-on: ubuntu-latest
steps:
- name: Retrieve code
2020-09-18 14:41:41 -06:00
uses: actions/checkout@v2
2020-09-18 15:38:33 -06:00
- name: Gitlab variables
2020-09-18 14:41:41 -06:00
id: vars
2020-09-18 15:38:33 -06:00
run: build/ci/gitlab-vars
2020-09-18 12:15:11 -06:00
2020-09-18 13:12:54 -06:00
- name: Login to GitHub Packages Docker Registry
uses: docker/login-action@v1
2020-09-18 12:15:11 -06:00
with:
registry: docker.pkg.github.com
2020-09-18 13:12:54 -06:00
username: ${{ github.repository_owner }}
2020-09-18 12:15:11 -06:00
password: ${{ secrets.GITHUB_TOKEN }}
2020-09-18 13:12:54 -06:00
- name: Login to DockerHub
uses: docker/login-action@v1
2020-09-18 12:15:11 -06:00
with:
username: neale
password: ${{ secrets.DOCKER_TOKEN }}
2020-09-18 13:12:54 -06:00
- name: Build and push moth image
uses: docker/build-push-action@v2
with:
2020-09-18 12:15:11 -06:00
target: moth
2020-09-18 13:12:54 -06:00
file: build/package/Containerfile
2020-09-18 15:38:33 -06:00
push: ${{ steps.vars.outputs.tags != '' }}
tags: ${{ steps.vars.outputs.moth-tags }}
2020-09-18 15:43:33 -06:00
dirtbags/moth:${{ steps.vars.outputs.tag }}
docker.pkg.github.com/dirtbags/moth/moth:${{ steps.vars.outputs.tag }}
2020-09-18 12:15:11 -06:00
2020-09-18 13:12:54 -06:00
- name: Build and push moth-devel image
2020-09-18 12:15:11 -06:00
uses: docker/build-push-action@v2
with:
2020-09-18 13:12:54 -06:00
target: moth
file: build/package/Containerfile
2020-09-18 15:43:33 -06:00
tags: |
dirtbags/moth-devel:${{ steps.vars.outputs.tag }}
docker.pkg.github.com/dirtbags/moth/moth-devel:${{ steps.vars.outputs.tag }}