Workflow config file is invalid. Please check your config file: yaml: line 50: could not find expected ':'
Adam Uhlíř ef353732ea
ci: build images on bee release (#57)
Co-authored-by: nugaon <50576770+nugaon@users.noreply.github.com>
2021-11-12 10:31:32 +01:00

80 lines
2.8 KiB
YAML

on:
repository_dispatch:
types: [ build-images ]
workflow_dispatch:
inputs:
buildImage:
description: 'Build and push Docker Image according to the environment'
default: 'false'
commitVersionTag:
description: 'The image tag will be retrieved from the bee version command'
default: 'false'
beeVersion:
description: 'The official bee image tag that the image will be built on. Default: last supported version'
default: 'latest'
beeVersionAsCommitHash:
description: 'The beeVersion parameter will be interpreted as a source code commit hash that the bee base image will be built on'
default: 'false'
stateCommit:
description: 'The images will have cheques by the traffic generation'
default: 'false'
push:
branches:
- 'master'
pull_request:
branches:
- '**'
env:
BEE_IMAGE_PREFIX: 'docker.pkg.github.com/ethersphere/bee-factory'
BUILD_IMAGE: 'true'
COMMIT_VERSION_TAG: 'true'
STATE_COMMIT: 'true'
BEE_VERSION: '${{ github.event.client_payload.tag }}'
jobs:
bee-images:
name: Build and publish images
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- name: Checkout
uses: actions/checkout@v2
- name: Override inputs from `workflow_dispatch`
run: |
if [[ '${{ github.event_name }}" == "workflow_dispatch"]]; then
echo "BEE_VERSION=${{ github.event.inputs.beeVersion }}" >> $GITHUB_ENV
echo "BUILD_IMAGE=${{ github.event.inputs.beeVersionAsCommitHash }}" >> $GITHUB_ENV
echo "COMMIT_VERSION_TAG=${{ github.event.inputs.commitVersionTag }}" >> $GITHUB_ENV
echo "STATE_COMMIT=${{ github.event.inputs.stateCommit }}" >> $GITHUB_ENV
fi
- name: Auth to Github Package Docker Registry
if: ${{ github.event_name == 'repository_dispatch' || (github.event.inputs.buildImage == 'true' && success()) }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin
- name: Install npm deps
run: npm ci
- name: Build images
run: |
BUILD_PARAMS=""
if [ $BUILD_IMAGE == 'true' ] ; then
BUILD_PARAMS+=" --build-base-bee --base-bee-commit-hash=$BEE_VERSION"
fi
if [ $STATE_COMMIT == 'true' ] ; then
BUILD_PARAMS+=" --gen-traffic"
fi
npm run build:env -- $BUILD_PARAMS
- name: Publish if required
if: ${{ github.event_name == 'repository_dispatch' || (github.event.inputs.buildImage == 'true' && success()) }}
run: |
npm run publish:env