Skip to content

Commit

Permalink
Adding workflow for json-to-lua (#2)
Browse files Browse the repository at this point in the history
Adding workflow for json-to-lua
  • Loading branch information
jharajeev55 authored May 2, 2024
1 parent a7a4c57 commit 0018cbd
Show file tree
Hide file tree
Showing 159 changed files with 5,300 additions and 24 deletions.
92 changes: 80 additions & 12 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Generate JSON and Save as Artifacts

on:
pull_request:
types:
types:
- opened
- reopened
- synchronize
Expand All @@ -12,8 +12,8 @@ on:
- "*"

jobs:
build:
name: generate-json-and-save-as-artifacts
webhelp-to-json:
name: webhelp-to-json
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -47,9 +47,82 @@ jobs:

- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: generated-json
path: data

json-to-lua:
name: json-to-lua
runs-on: ubuntu-latest
needs:
- webhelp-to-json

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

- name: Setup dotnet
uses: actions/setup-dotnet@v4

- name: Restore dependencies
run: |
cd Json_parser
dotnet restore
- name: Build the project
run: |
cd Json_parser
dotnet build --configuration Release
- name: Get Artifacts
uses: actions/download-artifact@v4
with:
name: generated-json
path: data/

- name: Run the binary with folder path
run: |
cd Json_parser
dotnet run $GITHUB_WORKSPACE/data/
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: keithley_instrument_libraries
path: ./Json_parser/keithley_instrument_libraries

publish:
name: Publish
if: ${{ endsWith(github.base_ref, 'main') && (contains(github.head_ref, 'release/') || github.event.pull_request.merged) }}
needs:
- webhelp-to-json
- json-to-lua
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://npm.pkg.github.com"
scope: "@tektronix"

- name: Get Artifacts
uses: actions/download-artifact@v4
with:
name: keithley_instrument_libraries
path: keithley_instrument_libraries/

- name: npm Package
run: npm pack

- name: publish package
run: |
npm publish *.tgz
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

release:
name: Release
runs-on: ubuntu-latest
Expand All @@ -58,7 +131,8 @@ jobs:
checks: write
pull-requests: read
needs:
- build
- webhelp-to-json
- json-to-lua
if: ${{ (endsWith(github.base_ref, 'main') && (contains(github.head_ref, 'release/')) || github.event.pull_request.merged ) }}
steps:
- name: Checkout
Expand Down Expand Up @@ -101,13 +175,7 @@ jobs:
echo "version=${V}" >> $GITHUB_OUTPUT
echo "cl_version=${CL}" >> $GITHUB_OUTPUT
echo "commit=${COMMIT}" >> $GITHUB_OUTPUT
- run: 'git tag --list ${V}*'
- name: Get Artifacts
uses: actions/download-artifact@v3
with:
name: generated-json
path: data/
- run: "git tag --list ${V}*"
- name: Get Changelog for this Tag
id: changelog
uses: coditory/changelog-parser@v1
Expand All @@ -134,4 +202,4 @@ jobs:
prerelease: ${{ (! github.event.pull_request.merged) || (github.event.pull_request.merged && ! contains(github.head_ref, 'release/')) }}
commit: ${{steps.lasttag.outputs.commit}}
makeLatest: true
tag: ${{steps.lasttag.outputs.version}}
tag: ${{steps.lasttag.outputs.version}}
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Create Release

# Create a release tag automatically when a pull request from a `release/**` branch is
# merged into the `main` branch.
# This will create the tag which will kick off a new build with a tagged release.

on:
pull_request:
branches:
- "release/**"
types:
- closed

jobs:
tag:
name: Tag Release
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.base_ref == 'main'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
set-safe-directory: "*"
- name: Get Version
id: version
run: |
V="${GITHUB_REF#refs/heads/release/v}"
echo "version=${V}" >> $GITHUB_OUTPUT
- name: Create Tag
run: |
V="v${{steps.version.outputs.version}}"
git tag "$V" -m "Release $V"
git push "$V"
39 changes: 39 additions & 0 deletions .github/workflows/release_candidate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release Candidate

# Create a release candidate tag automatically when a pull request from a `release/**`
# branch is merged into the `main` branch.
# This will create the tag which will kick off a new build with a tagged release
# candidate.

on:
pull_request:
branches:
- "release/**"

jobs:
tag:
name: Tag Release Candidate
runs-on: ubuntu-latest
if: github.base_ref == 'main'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
set-safe-directory: "*"
- name: Get Version
id: version
run: |
V="${GITHUB_REF#refs/heads/release/v}"
echo "version=${V}" >> $GITHUB_OUTPUT
- name: Create Tag
run: |
V="v${{steps.version.outputs.version}}"
LATEST="${V}-0" # Default to RC 0
NUM_RCS=$(git tag --list "${V}-*" | wc -l)
if [[ $NUM_RCS -gt 0 ]]; then
LATEST="${V}-$((NUM_RCS))"
fi
git tag "$LATEST" -m "Release Candidate $LATEST"
git push "$LATEST"
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
node_modules/
.vscode/
data/
Json_parser/.vs/
Json_parser/bin/
Json_parser/obj/
Json_parser/keithley_instrument_libraries/
Loading

0 comments on commit 0018cbd

Please sign in to comment.