Publish jsonnet on npm #236
Workflow file for this run
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
name: PR Build | |
on: | |
pull_request_target: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
paths: | |
- 'Java/**' | |
- 'JS/**' | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: read | |
outputs: | |
java: ${{ steps.filter.outputs.java }} | |
js: ${{ steps.filter.outputs.js }} | |
steps: | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
filters: | | |
java: | |
- 'Java/**' | |
js: | |
- 'JS/**' | |
java: | |
needs: changes | |
if: ${{ needs.changes.outputs.java == 'true' }} | |
runs-on: ubuntu-latest | |
outputs: | |
VALUE: ${{ steps.set_short_hash.outputs.VALUE }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set SHORT_HASH | |
id: set_short_hash | |
run: | | |
echo "::set-output name=VALUE::${{ github.sha }}" | |
echo "RELEASE_TAG=${{ github.sha }}-$(TZ=UTC-8 date +"%Y.%m.%d")" >> $GITHUB_ENV | |
- name: Goto Java folder | |
run: cd Java | |
- name: Set up JDK | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Set up Maven | |
uses: stCarolas/[email protected] | |
with: | |
maven-version: 3.9.3 | |
- name: Create output folder | |
run: mkdir -p Java/FlySpring/edgechain-app/BuildOutput | |
- name: Build edgechain-app project | |
working-directory: Java/FlySpring/edgechain-app | |
run: mvn clean package -DskipTests | |
- name: Run edgechain testcases | |
working-directory: Java/FlySpring/edgechain-app | |
run: mvn test | |
- name: Copy edgechain-app JAR to BuildOutput | |
run: cp Java/FlySpring/edgechain-app/target/edgechain.jar Java/FlySpring/edgechain-app/BuildOutput | |
js: | |
needs: changes | |
if: ${{ needs.changes.outputs.js == 'true' }} | |
permissions: | |
contents: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install Prettier | |
run: npm install prettier | |
- name: Install ESLint | |
run: > | |
npm install eslint@^8 && | |
npm install @microsoft/eslint-formatter-sarif@latest eslint-config-google@latest eslint-plugin-import@latest @typescript-eslint/eslint-plugin@latest @typescript-eslint/parser@latest eslint-config-prettier@latest eslint-plugin-prettier@latest | |
- name: Get cache date | |
id: get-date | |
run: echo "name=date::$(/bin/date -u "+%Y%m%d")" | |
shell: bash | |
- name: ESLint Cache | |
uses: actions/cache@v3 | |
with: | |
path: ./.eslintcache | |
key: ${{ runner.os }}-eslintcache-${{ hashFiles('./eslintcache') }} | |
restore-keys: | | |
${{ runner.os }}-eslintcache- | |
- name: Run ESLint | |
run: npx eslint JS | |
--fix | |
--cache | |
--config JS/.eslintrc.js | |
--ext .js,.jsx,.ts,.tsx | |
continue-on-error: true | |
- name: Run Prettiers | |
run: npx prettier --tab-width 4 --print-width 100 --trailing-comma es5 --ignore-path "$(CURDIR)/.prettierignore" --write JS/ | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Automatically applying Prettier changes | |
commit_user_name: GitHub Actions | |
commit_user_email: [email protected] | |
commit_author: GitHub Actions <[email protected]> | |
branch: ts | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Goto JS folder | |
run: cd JS/edgechains/lib | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: npm install | |
working-directory: JS/edgechains/lib | |
- name: Build edgechain-app project | |
run: npm run build | |
working-directory: JS/edgechains/lib | |
- name: Package edgechain-app project | |
run: npm pack | |
working-directory: JS/edgechains/lib |