Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

docs: add fdp-play #2457

docs: add fdp-play

docs: add fdp-play #2457

Workflow file for this run

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'
branch:
description: 'Branch of this repo to build (default "master")'
default: master
required: false
push:
branches:
- 'master'
pull_request:
branches:
- '**'
env:
BEE_IMAGE_PREFIX: 'ethersphere'
BUILD_IMAGE: 'false'
COMMIT_VERSION_TAG: 'false'
STATE_COMMIT: 'true'
BEE_VERSION: '${{ github.event.client_payload.tag }}'
BEE_PLATFORM: 'linux/amd64,linux/arm64,linux/arm/v7'
jobs:
bee-images:
name: Build and publish images
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.branch }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- 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
else
echo "BEE_VERSION=${BEE_VERSION/v}" >> $GITHUB_ENV
fi
- name: Auth to Docker Hub
if: ${{ github.event_name == 'repository_dispatch' || (github.event.inputs.buildImage == 'true' && success()) }}
run: |
echo "PUSH_IMAGES=1" >> $GITHUB_ENV
echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u ${{secrets.DOCKERHUB_USERNAME}} --password-stdin
- uses: actions/cache@v3
id: cache-npm
with:
path: generator/node_modules
key: ${{ runner.os }}-${{ hashFiles('generator/package-lock.json') }}
- name: Install npm deps
if: steps.cache-npm.outputs.cache-hit != 'true'
run: cd ./generator && npm ci
- name: Build images
id: build
run: |
cd ./generator
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: Update bee version in package.json
uses: jossef/action-set-json-field@v2
if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.tag != 'latest' }}
with:
file: package.json
field: engines.bee
value: ${{ env.BEE_VERSION }}
- name: Add trailing new-line to package.json
if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.tag != 'latest' }}
run: printf "\n" >> package.json
- name: Create/update PR
if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.tag != 'latest' }}
uses: gr2m/create-or-update-pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.REPO_GHA_PAT }}
with:
title: "chore: update to bee ${{ env.BEE_VERSION }}"
body: "Updated Bee version ${{ env.BEE_VERSION }}"
branch: "bee-${{ env.BEE_VERSION }}"
commit-message: "chore: update to new bee"
author: "bee-worker <[email protected]>"
- name: Trigger Bee-js PR creation
if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.tag != 'latest' }}
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.REPO_GHA_PAT }}
repository: ethersphere/bee-js
event-type: update-bee
client-payload: '{"beeVersion": "${{ steps.build.outputs.full-version }}", "apiVersion": "${{ steps.build.outputs.api-version }}", "debugApiVersion": "${{ steps.build.outputs.debug-api-version }}"}'