Skip to content

Matrix Build and Release #22

Matrix Build and Release

Matrix Build and Release #22

Workflow file for this run

name: Build and Release
permissions: write-all
on:
push:
branches:
- main # You can change this to match your main branch name
schedule:
- cron: '0 0 * * 1' # Run every Monday at midnight UTC
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install packages into building machine
run: sudo apt-get install -y unzip qemu-utils rsync gdisk
- name: Run script to download and modify the CHR images
run: sudo bash build.bash
- name: Upload created image files as artifacts of build
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: ./chr*
- name: Get RouterOS version number
id: get-versions
run: |
ROSTEST=`curl https://download.mikrotik.com/routeros/NEWESTa7.testing | awk '{print $1}'`
ROSSTABLE=`curl https://download.mikrotik.com/routeros/NEWESTa7.stable | awk '{print $1}'`
echo "stable=$ROSSTABLE" >> $GITHUB_OUTPUT
echo "testing=$ROSTEST" >> $GITHUB_OUTPUT
echo "stable=$ROSSTABLE"
echo "testing=$ROSTEST"
- name: Print versions for debugging
run: |
echo "The latest stable version is ${{ steps.get-versions.outputs.stable }}"
echo "The latest testing version is ${{ steps.get-versions.outputs.testing }}"
- name: Push git tag to save builder's code (required for release)
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git tag Build${{ github.run_id }}
git push origin Build${{ github.run_id }}
- name: Create GitHub release
id: create-release
uses: actions/create-release@v1 # comnoco/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: Build${{ github.run_id }} # ${{ github.ref }}
release_name: ${{ steps.get-versions.outputs.testing }} / ${{ steps.get-versions.outputs.stable }} (Build${{ github.run_id }})
body: |
UEFI-enabled CHR images from builder ${{ github.run_id }} -
testing: ${{ steps.get-versions.outputs.testing }}
stable: ${{ steps.get-versions.outputs.stable }}
draft: false
prerelease: false
- name: Upload CHR TESTING image to release
id: upload-release-asset-testing
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./chr-${{ steps.get-versions.outputs.testing }}.uefi-fat.raw
asset_name: chr-${{ steps.get-versions.outputs.testing }}.uefi-fat.raw
asset_content_type: application/octet-stream
- name: Upload CHR STABLE image to release
id: upload-release-asset-stable
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: ./chr-${{ steps.get-versions.outputs.stable }}.uefi-fat.raw
asset_name: chr-${{ steps.get-versions.outputs.stable }}.uefi-fat.raw
asset_content_type: application/octet-stream