Skip to content

govite-nightly-build #67

govite-nightly-build

govite-nightly-build #67

name: govite-nightly-build
on:
workflow_call:
inputs:
branch:
type: string
required: true
tag:
type: string
required: true
workflow_dispatch:
inputs:
branch:
description: 'nightly build from'
required: true
tag:
description: 'tag prefix'
required: true
jobs:
build:
runs-on: ubuntu-18.04
steps:
# Inconsistent inputs context for workflow_dispatch and workflow_call
- name: Set branch and tag
id: step0
run: |
echo "::set-output name=branch::${{ (inputs || github.event.inputs).branch }}"
echo "::set-output name=tag::${{ (inputs || github.event.inputs).tag }}"
- name: Echo branch and tag
run: echo ${{ steps.step0.outputs.branch }} ${{ steps.step0.outputs.tag }}
- uses: actions/checkout@v2
with:
repository: 'vitelabs/go-vite'
ref: '${{ steps.step0.outputs.branch }}'
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
- name: Test
run: make test
- name: Get Build Version
id: version
run: echo "::set-output name=version::$(date +%Y%m%d%H%M)"
- name: Build
run: echo "${{ steps.step0.outputs.tag }}-nightly-${{ steps.version.outputs.version }}" > version/buildversion ; make all
- name: Release Log
run: cd build/cmd/gvite ;ls | grep -v ".tar.gz" | while read line; do tar zcvf $line.tar.gz $line ; openssl dgst -sha256 $line.tar.gz >> release.sha256.log ;done ; cd ../../../
- name: Release
uses: ncipollo/release-action@v1
with:
tag: "${{ steps.step0.outputs.tag }}-nightly-${{ steps.version.outputs.version }}"
artifacts: "build/cmd/gvite/*.tar.gz"
bodyFile: "build/cmd/gvite/release.sha256.log"
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up Docker QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Available Docker platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
push: true
context: .
file: docker/Dockerfile
platforms: linux/amd64, linux/arm64
tags: vitelabs/gvite-nightly:${{ steps.step0.outputs.tag }}-${{ steps.version.outputs.version }},vitelabs/gvite-nightly:${{ steps.step0.outputs.tag }}-latest,vitelabs/gvite-nightly:latest