Skip to content

Release Bundle

Release Bundle #361

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Release Bundle
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
bundle_key:
description: 'Bundle Name'
required: true
default: "broadcast_1.4"
target_platform:
description: 'Target Platform'
required: true
default: 'Windows'
type: choice
options:
- Windows
- Linux
previous_tag:
description: 'Previous Tag or Commit'
required: false
env:
GH_USERNAME: "nodos-bot"
GH_TOKEN: ${{ secrets.CI_TOKEN }}
GIT_EMAIL: "bot@nodos.dev"
PREVIOUS_COMMIT: ${{ github.event.inputs.previous_tag }}
# TODO: Support parallel runs
concurrency:
group: ${{ github.ref_name }} # For now, allow 1 run at a time for each branch
cancel-in-progress: false # Queue up runs if one is already in progress.
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
set-build-number:
name: Set Build Number
runs-on: [self-hosted, bundler]
outputs:
build_number: ${{ steps.offset-build-number.outputs.build_number }}
steps:
- name: Offset Build Number
id: offset-build-number
shell: bash
run: |
BUILD_NUMBER=$(( ${{ github.run_number }} + 3527 ))
echo "build_number=$BUILD_NUMBER" >> $GITHUB_OUTPUT
prepare-strategy:
name: Prepare Strategy
runs-on: [self-hosted, bundler]
outputs:
runner-tags: ${{ steps.prepare-step.outputs.runner-tags }}
steps:
- name: Prepare Runner Tags
id: prepare-step
shell: bash
run: |
runner_tags="['self-hosted', 'bundler', '${{ inputs.target_platform }}']"
echo Runner Tags: $runner_tags
echo "runner-tags=$runner_tags" >> $GITHUB_OUTPUT
bundle:
name: Bundle Nodos (${{ github.event.inputs.bundle_key }})
env:
BUILD_NUMBER: ${{ needs.set-build-number.outputs.build_number }}
runs-on: ${{ fromJson(needs.prepare-strategy.outputs.runner-tags) }}
needs: [prepare-strategy, set-build-number]
steps:
- name: Setup Environment Variables
shell: bash
run: |
if [ "${{ runner.os }}" == "Linux" ]; then
echo "DIST_TARGET_DIR=${NOS_BUILD_DIR}/Bundler" >> $GITHUB_ENV
else
echo "DIST_TARGET_DIR=${NOS_BUILD_DIR}\\Bundler" >> $GITHUB_ENV
fi
- name: Update Git Credentials
continue-on-error: true
shell: bash
run: |
git credential-manager github login --username ${{ env.GH_USERNAME }} --token ${{ env.GH_TOKEN }} --force
- name: Checkout Repository
uses: actions/checkout@v2
with:
repository: nodos-dev/bundler
ref: ${{ github.ref }}
token: ${{ env.GH_TOKEN }}
path: ./bundler-${{ github.ref_name }}
fetch-depth: 01
- name: Copy Nosman
shell: bash
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
powershell.exe -Command "Invoke-WebRequest -Uri 'https://github.com/nodos-dev/workspace/releases/latest/download/nosman-windows-x86_64.exe' -OutFile 'nodos.exe'"
else
curl -L -o nodos https://github.com/nodos-dev/workspace/releases/latest/download/nosman-linux-x86_64
chmod +x ./nodos
fi
working-directory: ./bundler-${{ github.ref_name }}
- name: Download Nodos
id: create_installer
run: |
python ./bundler.py --bundle-key="${{ github.event.inputs.bundle_key}}" --bundles-json="./bundles.json" --download-nodos
working-directory: ./bundler-${{ github.ref_name }}/
- name: Download Packages
id: download_packages
run: |
python ./bundler.py --bundle-key="${{ github.event.inputs.bundle_key}}" --bundles-json="./bundles.json" --download-packages
working-directory: ./bundler-${{ github.ref_name }}/
- name: Create Package
id: create_package
run: |
python ./bundler.py --bundle-key="${{ github.event.inputs.bundle_key}}" --bundles-json="./bundles.json" --pack
working-directory: ./bundler-${{ github.ref_name }}/
- name: Copy Bundle to Distribution Machine
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path "${{ env.DIST_TARGET_DIR }}/${{ needs.set-build-number.outputs.build_number }}"
copy ./Artifacts/Nodos-*.zip ${{ env.DIST_TARGET_DIR }}/${{ needs.set-build-number.outputs.build_number }}
working-directory: ./bundler-${{ github.ref_name }}
- name: Create Release
id: release_nos_main_repo
shell: pwsh
run: |
python ./bundler.py --bundle-key="${{ github.event.inputs.bundle_key}}" --bundles-json="./bundles.json" --gh-release --gh-release-repo="https://github.com/nodos-dev/bundler" --gh-release-target-branch="${{ github.ref_name }}"
working-directory: ./bundler-${{ github.ref_name }}/