Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions .github/workflows/build-export-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
name: Build, Export, and Publish

on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Version to publish (e.g. v0.16.0)'
required: true

jobs:
build-export-publish:
runs-on: [AS6-runner]

permissions:
contents: read
packages: write

env:
PROJECT: example/AsProject/AsProject.apj
PROJECT_DIR: example/AsProject
LIBRARY: VarTools
LIBRARY_DIR: src/Ar/VarTools
EXPORT_DIR: export

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://npm.pkg.github.com'
scope: '@loupeteam'

- name: Resolve version
id: version
shell: pwsh
run: |
if ($env:GITHUB_REF_TYPE -eq 'tag') {
$ver = $env:GITHUB_REF_NAME -replace '^v', ''
} else {
$ver = "${{ inputs.version }}" -replace '^v', ''
}
if (-not $ver) {
Write-Error "Could not determine version. Push a v*.*.* tag or supply the version input."
exit 1
}
Write-Host "Publishing version: $ver"
"version=$ver" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_OUTPUT

- name: Find AS6 build executable
uses: loupeteam/br-actions/find-as6-build@v1
id: find-as

- name: Build Intel
uses: loupeteam/br-actions/build-as-project@v1
with:
exe-path: ${{ steps.find-as.outputs.exe-path }}
project: ${{ env.PROJECT }}
config: Intel

- name: Build ARM
uses: loupeteam/br-actions/build-as-project@v1
with:
exe-path: ${{ steps.find-as.outputs.exe-path }}
project: ${{ env.PROJECT }}
config: ARM

- name: Export library
uses: loupeteam/br-actions/export-as-library@v1
with:
project-dir: ${{ env.PROJECT_DIR }}
library: ${{ env.LIBRARY }}
library-dir: ${{ env.LIBRARY_DIR }}
configs: Intel ARM
output: ${{ env.EXPORT_DIR }}
as-install: ${{ steps.find-as.outputs.install-path }}

- name: Locate exported version directory
id: export-dir
shell: pwsh
run: |
$path = Get-ChildItem "$env:EXPORT_DIR/$env:LIBRARY" -Directory |
Select-Object -First 1 -ExpandProperty FullName
if (-not $path) {
Write-Error "No exported version directory found under $env:EXPORT_DIR/$env:LIBRARY"
exit 1
}
Write-Host "Exported version directory: $path"
"path=$path" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_OUTPUT

- name: Generate package.json
uses: loupeteam/br-actions/prepare-lpm-package@v1
with:
library-dir: ${{ env.LIBRARY_DIR }}
output-dir: ${{ steps.export-dir.outputs.path }}
version: ${{ steps.version.outputs.version }}

- name: Publish to GitHub Packages
shell: pwsh
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Write-Host "Publishing @loupeteam/$($env:LIBRARY.ToLower())@${{ steps.version.outputs.version }}"
Push-Location "${{ steps.export-dir.outputs.path }}"
npm publish
Pop-Location

- name: Upload exported library artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.LIBRARY }}-${{ steps.version.outputs.version }}
path: ${{ env.EXPORT_DIR }}/${{ env.LIBRARY }}/
if-no-files-found: error

- name: Upload build diagnostics
if: always()
uses: actions/upload-artifact@v4
with:
name: BuildDiagnostics
path: example/AsProject/Temp/BuildDiagnostics.log
if-no-files-found: ignore
89 changes: 57 additions & 32 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,57 @@
# This workflow will run build an AS project and publish the libraries to the github package registry

name: Build Libraries

on:
workflow_dispatch:
push:
branches-ignore:
- 'main'

jobs:
build-libraries:
runs-on: [AS411]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
path: "main"
lfs: true
- name: Fix LFS
run: |
cd ./main
git lfs pull
- name: Install AS upgrades
run: python.exe C:/Tools/AsPython/InstallUpgrades.py ${{ github.workspace }}/main/upgrades -asp AS411 -r --logLevel DEBUG
- name: Build project
run: python.exe C:/Tools/AsPython/CmdLineBuild.py ${{ github.workspace }}/main/example/AsProject/AsProject.apj -c Intel ARM -bm Rebuild -sim --logLevel DEBUG
- name: Export libraries
run: python.exe C:/Tools/AsPython/CmdLineExportLib.py ${{ github.workspace }}/main/example/AsProject/AsProject.apj -dest ./libs -c Intel ARM -wl vartools -l DEBUG -o -bm "None"
name: Build

on:
workflow_dispatch:
inputs:
build-mode:
description: 'Build mode'
required: false
default: 'Build'
type: choice
options:
- Build
- Rebuild
pull_request:
paths-ignore:
- '**/*.md'
- 'docs/**'
- 'LICENSE'

jobs:
build:
runs-on: [AS6-runner]

env:
PROJECT: example/AsProject/AsProject.apj

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Find AS6 build executable
uses: loupeteam/br-actions/find-as6-build@v1
id: find-as

- name: Build Intel
uses: loupeteam/br-actions/build-as-project@v1
with:
exe-path: ${{ steps.find-as.outputs.exe-path }}
project: ${{ env.PROJECT }}
config: Intel
build-mode: ${{ inputs.build-mode || 'Build' }}

- name: Build ARM
uses: loupeteam/br-actions/build-as-project@v1
with:
exe-path: ${{ steps.find-as.outputs.exe-path }}
project: ${{ env.PROJECT }}
config: ARM
build-mode: ${{ inputs.build-mode || 'Build' }}

- name: Upload build diagnostics
if: always()
uses: actions/upload-artifact@v4
with:
name: BuildDiagnostics
path: example/AsProject/Temp/BuildDiagnostics.log
if-no-files-found: ignore
40 changes: 0 additions & 40 deletions .github/workflows/buildPublish.yml

This file was deleted.

18 changes: 18 additions & 0 deletions src/Ar/VarTools/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@loupeteam/vartools",
"version": "0.0.0",
"description": "Helper library for getting and setting variable values in B&R Automation Studio",
"homepage": "https://loupeteam.github.io/LoupeDocs/libraries/vartools.html",
"scripts": {},
"keywords": [],
"author": "Loupe",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/loupeteam/vartools"
},
"lpm": {
"type": "library"
},
"dependencies": {}
}
Loading