-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use workflow to generate manifest and upload to s3
- Loading branch information
1 parent
8e4d3b1
commit 13eb075
Showing
7 changed files
with
220 additions
and
105 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,109 @@ | ||
name: Build Openocd for all platforms | ||
on: [workflow_call] | ||
|
||
jobs: | ||
|
||
build-mac-14-arm: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Install Dependencies | ||
run: | | ||
brew update | ||
brew install automake | ||
brew install texinfo | ||
brew install libtool | ||
export PATH=/usr/local/opt/texinfo/bin:$PATH | ||
- name: build-openocd | ||
run: | | ||
./build-openocd.sh | ||
- name: Publish OpenOCD packaged for mac | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifact-mac-14-arm-release | ||
path: ./openocd | ||
if-no-files-found: error | ||
|
||
build-mac-12: | ||
runs-on: macos-12 | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@v4 | ||
- name: Install Dependencies | ||
run: | | ||
brew update | ||
brew install automake | ||
brew install texinfo | ||
export PATH=/usr/local/opt/texinfo/bin:$PATH | ||
- name: build-openocd | ||
run: | | ||
./build-openocd.sh | ||
- name: Publish OpenOCD packaged for mac | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifact-mac-12-release | ||
path: ./openocd | ||
if-no-files-found: error | ||
|
||
build-linux-22-04: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libudev-dev | ||
sudo apt-get install libtool | ||
sudo apt-get install autoconf | ||
- name: build-openocd | ||
run: | | ||
./build-openocd.sh | ||
- name: Publish OpenOCD packaged for linux | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifact-linux-22-04-release | ||
path: ./openocd | ||
if-no-files-found: error | ||
|
||
build-linux-20-04: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install Dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libudev-dev | ||
sudo apt-get install libtool | ||
sudo apt-get install autoconf | ||
- name: build-openocd | ||
run: | | ||
./build-openocd.sh | ||
- name: Publish OpenOCD packaged for linux | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifact-linux-20-04-release | ||
path: ./openocd | ||
if-no-files-found: error | ||
|
||
build-windows: | ||
runs-on: windows-latest | ||
defaults: | ||
run: | ||
shell: msys2 {0} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: msys2/setup-msys2@v2 | ||
with: | ||
msystem: UCRT64 | ||
update: true | ||
install: git autotools mingw-w64-x86_64-cmake mingw-w64-ucrt-x86_64-gcc | ||
- name: build-openocd | ||
run: | | ||
./build-openocd.sh | ||
- name: Publish OpenOCD packaged for windows | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifact-windows-release | ||
path: ./openocd | ||
if-no-files-found: error |
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,20 @@ | ||
name: Publish | ||
on: | ||
workflow_call: | ||
inputs: | ||
build_run_id: | ||
description: 'The run id of the build job' | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
download-artifacts: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download all artifacts | ||
uses: dawidd6/[email protected] | ||
with: | ||
run_id: ${{ inputs.build_run_id }} | ||
path: build/ | ||
- name: ls build | ||
run: ls build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
# Directory path | ||
dir_path=${1:-"./build"} | ||
|
||
# Iterate over each folder in the specified directory | ||
for folder in "$dir_path"/openocd-*; do | ||
if [[ -d $folder ]]; then | ||
# Create the tar.gz archive | ||
tar -czf "${folder}.tar.gz" -C "$dir_path" "$(basename "$folder")" | ||
echo "Created archive: ${folder}.tar.gz" | ||
else | ||
echo "Skipping non-directory: $folder" | ||
fi | ||
done |
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,64 @@ | ||
#!/bin/bash | ||
|
||
# Read the version from the version file | ||
version=$(cat version) | ||
# Directory containing the files | ||
dir_path=${1:-"./build"} | ||
|
||
# Function to generate manifest.json content | ||
generate_manifest() { | ||
platform=$1 | ||
arch=$2 | ||
new_path=$3 | ||
name=$4 | ||
version=$5 | ||
sha256=$6 | ||
|
||
echo "platform: $platform" | ||
cat <<EOL > ${dir_path}/${new_path}/${name}-${version}-manifest.json | ||
{ | ||
"name": "${name}", | ||
"version": "${version}", | ||
"main": "./bin", | ||
"url": "https://binaries.particle.io/openocd/${platform}/${arch}/${version}.tar.gz", | ||
"sha256": "${sha256}" | ||
} | ||
EOL | ||
} | ||
|
||
# Iterate over each file and generate the manifest.json | ||
for file in "$dir_path"/*.tar.gz; do | ||
filename=$(basename -- "$file") | ||
# Extract platform and arch from the filename | ||
echo "doing something" | ||
platform=$(echo $filename | awk -F '-' '{print $2}') | ||
arch=$(echo $filename | awk -F '-' '{print $3}') | ||
|
||
if [[ -z $platform || -z $arch ]]; then | ||
echo "Unknown file pattern: $filename" | ||
continue | ||
fi | ||
|
||
# Define name | ||
name="openocd" | ||
|
||
# Generate the new file name without the extension | ||
new_file_name="${name}-${version}" | ||
new_path="${name}-${platform}-${arch}" | ||
# Create a directory for the current file to store the manifest.json | ||
echo "creating directory ${dir_path}/${new_path}" | ||
echo ${new_file_name} | ||
echo ${new_path} | ||
mkdir -p "${dir_path}/${new_path}" | ||
|
||
|
||
# Copy the original file to the new directory | ||
cp "$file" "${dir_path}/${new_path}/${new_file_name}.tar.gz" | ||
|
||
# Calculate the SHA-256 checksum | ||
sha256=$(sha256sum "$file" | awk '{ print $1 }') | ||
|
||
# Generate the manifest.json for the current file | ||
generate_manifest "$platform" "$arch" "$new_path" "$name" "$version" "$sha256" | ||
echo "Generated ${dir_path}/${new_path}/${new_file_name}/${name}-${version}-manifest.json" | ||
done |
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 @@ | ||
0.12.0-particle-d8e1d63 |