More CI build twiddling

This commit is contained in:
Neale Pickett 2020-09-18 14:41:41 -06:00
parent c52f15f55b
commit 2ff9d3a059
2 changed files with 31 additions and 61 deletions

View File

@ -1,5 +1,13 @@
name: Tests name: Build/Test
on: [push]
on:
push:
branches:
- v3
- devel
- master
tags:
- 'v*.*.*'
jobs: jobs:
test-mothd: test-mothd:
@ -9,20 +17,36 @@ jobs:
- name: Install Go - name: Install Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.13 go-version: 1.13
- name: Retrieve code - name: Retrieve code
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: Test - name: Test
run: go test ./... run: go test ./...
publish: publish:
name: Publish latest build name: Publish container images
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Retrieve code - name: Retrieve code
uses: actions/checkout@v1 uses: actions/checkout@v2
- name: Get current branch
id: vars
run: |
case $GITHUB_REF in
refs/tags/*)
TAGS=latest,${GITHUB_REF#refs/tags/}
;;
refs/heads/master)
TAGS=latest
;;
esac
echo "::set-output name=tags::$TAGS"
- name: Login to GitHub Packages Docker Registry - name: Login to GitHub Packages Docker Registry
if: steps.vars.tags != ''
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
registry: docker.pkg.github.com registry: docker.pkg.github.com
@ -30,6 +54,7 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub - name: Login to DockerHub
if: steps.vars.tags != ''
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
username: neale username: neale

View File

@ -1,55 +0,0 @@
name: Publish
on:
push:
tags:
- 'v*' # Only versioned tags
jobs:
publish:
name: Publish Container Image
runs-on: ubuntu-latest
steps:
- name: Retrieve code
uses: actions/checkout@v1
- name: Push moth to GitHub Packages
uses: docker/build-push-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
target: moth
file: build/package/Containerfile
registry: docker.pkg.github.com
repository: dirtbags/moth/moth
tag_with_ref: true
- name: Push moth-devel to GitHub Packages
uses: docker/build-push-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
target: moth-devel
file: build/package/Containerfile
registry: docker.pkg.github.com
repository: dirtbags/moth/moth-devel
tag_with_ref: true
- name: Push moth to Docker Hub
uses: docker/build-push-action@v2
with:
username: neale
password: ${{ secrets.DOCKER_TOKEN }}
target: moth
file: build/packages/Containerfile
repository: dirtbags/moth
tag_with_ref: true
- name: Push moth-devel to Docker Hub
uses: docker/build-push-action@v2
with:
username: neale
password: ${{ secrets.DOCKER_TOKEN }}
target: moth-devel
file: build/packages/Containerfile
repository: dirtbags/moth-devel
tag_with_ref: true