Main #187
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Main" | |
on: | |
workflow_dispatch: | |
inputs: | |
core: | |
description: "Bump type, it must be: patch | minor | major" | |
required: true | |
dappmanager: | |
description: "Version of the dappmanager. Only numbers" | |
required: true | |
wifi: | |
description: "Version of the wifi. Only numbers" | |
required: true | |
bind: | |
description: "Version of the bind. Only numbers" | |
required: true | |
ipfs: | |
description: "Version of the ipfs. Only numbers" | |
required: true | |
env: | |
CORE_BUMP_TYPE: ${{ github.event.inputs.core }} | |
BIND_VERSION: ${{ github.event.inputs.bind }} | |
IPFS_VERSION: ${{ github.event.inputs.ipfs }} | |
DAPPMANAGER_VERSION: ${{ github.event.inputs.dappmanager }} | |
WIFI_VERSION: ${{ github.event.inputs.wifi }} | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' | |
steps: | |
- name: Verify bump type | |
run: | | |
[[ "$CORE_BUMP_TYPE" == "patch" ]] || [[ "$CORE_BUMP_TYPE" == "minor" ]] || \ | |
[[ "$CORE_BUMP_TYPE" == "major" ]] || { echo "Wrong input, it must be: patch | minor | major"; exit 1; } | |
- name: Check versions regex | |
run: | | |
[[ $BIND_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $IPFS_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $DAPPMANAGER_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && \ | |
[[ $WIFI_VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "versions introduced in wrong format"; exit 1; } | |
- uses: actions/checkout@v2 | |
# Edit the manifest with the new versions introduced | |
- name: Set new versions | |
run: | | |
sed -i -e "/bind.dnp.dappnode.eth/s/[0-9]*\.[0-9]*\.[0-9]*/"${BIND_VERSION}"/" dappnode_package.json | |
sed -i -e "/ipfs.dnp.dappnode.eth/s/[0-9]*\.[0-9]*\.[0-9]*/"${IPFS_VERSION}"/" dappnode_package.json | |
sed -i -e "/dappmanager.dnp.dappnode.eth/s/[0-9]*\.[0-9]*\.[0-9]*/"${DAPPMANAGER_VERSION}"/" dappnode_package.json | |
sed -i -e "/wifi.dnp.dappnode.eth/s/[0-9]*\.[0-9]*\.[0-9]*/"${WIFI_VERSION}"/" dappnode_package.json | |
cat dappnode_package.json | |
- name: Setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "18.x" | |
- name: Publish | |
run: npx @dappnode/dappnodesdk publish ${CORE_BUMP_TYPE} --dappnode_team_preset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check git diff | |
id: git_diff | |
run: | | |
git diff --no-patch dappnode_package.json docker-compose.yml releases.json && echo '::set-output name=HAS_CHANGED::true' || echo '::set-output name=HAS_CHANGED::false' | |
- name: Create Pull Request | |
if: steps.git_diff.outputs.HAS_CHANGED == 'true' | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
add-paths: "dappnode_package.json,docker-compose.yml,releases.json" | |
commit-message: "update core packages versions" | |
branch: "update-versions" | |
title: "update core packages versions" | |
delete-branch: true |