Skip to content

Merge pull request #105 from herbygillot/patch-1 #60

Merge pull request #105 from herbygillot/patch-1

Merge pull request #105 from herbygillot/patch-1 #60

Workflow file for this run

name: build
on:
push:
branches:
- 'main'
tags:
- '*'
pull_request:
branches:
- '*'
env:
QUAY_SLUG: quay.io/jzelinskie/faq
jobs:
validate:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Validate
uses: docker/bake-action@v1
with:
targets: validate
test-ctn:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Test
uses: docker/bake-action@v1
with:
targets: test
-
name: Upload coverage
uses: codecov/codecov-action@v2
with:
file: ./coverage.txt
test-host:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
runs-on: ${{ matrix.os }}
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ^1.15
-
name: Test
run: make test
build:
runs-on: ubuntu-latest
needs:
- validate
- test-ctn
- test-host
steps:
-
name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
${{ env.QUAY_SLUG }}
tags: |
type=ref,event=tag
type=ref,event=pr
type=edge
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/') }}
labels: |
org.opencontainers.image.title=faq
org.opencontainers.image.description=Format Agnostic jQ -- process various formats with libjq
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to Quay
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: quay.io
username: jzelinskie+faq_gha
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
-
name: Build artifacts
uses: docker/bake-action@v1
with:
targets: artifact-all
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Move artifacts
run: |
mv ./dist/**/* ./dist/
-
name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: faq
path: ./dist/*
if-no-files-found: error
-
name: Build
uses: docker/bake-action@v1
with:
files: |
./docker-bake.hcl
${{ steps.meta.outputs.bake-file }}
targets: image-all
push: ${{ github.event_name != 'pull_request' }}
-
name: GitHub Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: |
dist/*.tar.gz
dist/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}