-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: website*microzig publish with artifact restructuring
Ability to publish both microzig and the website based on a tag/push. The microzig boxzer artifact output is also restructured to be flatter.
- Loading branch information
Showing
9 changed files
with
222 additions
and
56 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: Reusasble Alter Microzig Artifact | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
in-gh-artifact-name: | ||
required: true | ||
type: string | ||
description: The github artifact to download the artifact from. | ||
out-gh-artifact-name: | ||
required: true | ||
type: string | ||
description: The github artifact to upload to | ||
source-path: | ||
required: false | ||
type: string | ||
default: "" | ||
description: | | ||
The path within the github artifact where the artifact is located at | ||
zig-version: | ||
required: true | ||
type: string | ||
description: The zig version to use. | ||
microzig-version: | ||
required: true | ||
type: string | ||
description: The microzig version to use | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Download the requested github artifact | ||
- name: Download artifacts | ||
id: download | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.in-gh-artifact-name }} | ||
# Get the path to where the artifact is at. This is the path to the | ||
# downloaded artifact that is relative to the github workspace with the | ||
# source-path parameter tacked on the end. | ||
- name: Get Source Path | ||
shell: bash | ||
id: get-source-path | ||
run: | | ||
echo "path=$( \ | ||
realpath -s --relative-to="${{ github.workspace }}" \ | ||
"${{ steps.download.outputs.download-path }}/${{ inputs.source-path }}" \ | ||
)" >> $GITHUB_OUTPUT | ||
- name: Create base folder structure | ||
shell: bash | ||
id: base-folders | ||
run: | | ||
mkdir ./output | ||
mkdir "./output/zig-${{ inputs.zig-version }}/" | ||
mkdir "./output/zig-${{ inputs.zig-version }}/microzig-${{ inputs.microzig-version }}/" | ||
echo "path=./output/zig-${{ inputs.zig-version }}/microzig-${{ inputs.microzig-version }}/" >> $GITHUB_OUTPUT | ||
mkdir "./output/zig-${{ inputs.zig-version }}/microzig-${{ inputs.microzig-version }}/bsp/" | ||
mkdir "./output/zig-${{ inputs.zig-version }}/microzig-${{ inputs.microzig-version }}/build/" | ||
mkdir "./output/zig-${{ inputs.zig-version }}/microzig-${{ inputs.microzig-version }}/examples/" | ||
mkdir "./output/zig-${{ inputs.zig-version }}/microzig-${{ inputs.microzig-version }}/tools/" | ||
- name: Get glob safe base paths | ||
id: get-glob-paths | ||
shell: bash | ||
run: | | ||
echo "source-path=$(printf "%q" "${{ steps.get-source-path.outputs.path }}")" >> $GITHUB_OUTPUT | ||
echo "output-path=$(printf "%q" "${{ steps.base-folders.outputs.path }}")" >> $GITHUB_OUTPUT | ||
- name: Copy Root, Build, Core, Tools | ||
shell: bash | ||
run: | | ||
mv ${{ steps.get-glob-paths.outputs.source-path }}/microzig-*.tar.gz "${{ steps.base-folders.outputs.path }}/microzig.tar.gz" | ||
mv ${{ steps.get-glob-paths.outputs.source-path }}/microzig-*/build-*.tar.gz "${{ steps.base-folders.outputs.path }}/microzig-build.tar.gz" | ||
mv ${{ steps.get-glob-paths.outputs.source-path }}/microzig-*/core-*.tar.gz "${{ steps.base-folders.outputs.path }}/microzig-core.tar.gz" | ||
mv ${{ steps.get-glob-paths.outputs.source-path }}/microzig-*/build/definitions-*.tar.gz "${{ steps.base-folders.outputs.path }}/build/definitions.tar.gz" | ||
- name: Move examples, bsp | ||
shell: bash | ||
run: | | ||
mv ${{ steps.get-glob-paths.outputs.source-path }}/microzig-*/bsp/*/*.tar.gz "${{ steps.base-folders.outputs.path }}/bsp/" | ||
mv ${{ steps.get-glob-paths.outputs.source-path }}/microzig-*/examples/*/*.tar.gz "${{ steps.base-folders.outputs.path }}/examples/" | ||
- name: Rename examples, bsp | ||
shell: bash | ||
run: | | ||
find "${{ steps.base-folders.outputs.path }}/examples" -type f -exec sh -c 'mv "{}" "$(dirname -- "{}")/$(basename -- "{}" | sed "s/-.*\.tar\.gz/-examples.tar.gz/g")"' \; | ||
find "${{ steps.base-folders.outputs.path }}/bsp" -type f -exec sh -c 'mv "{}" "$(dirname -- "{}")/$(basename -- "{}" | sed "s/-.*\.tar\.gz/-bsp.tar.gz/g")"' \; | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ inputs.out-gh-artifact-name }} | ||
path: "./output/" |
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
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
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
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
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
Oops, something went wrong.