From a247d2754ae2fb3e7bcb6b1c64e5e866f8a33c9b Mon Sep 17 00:00:00 2001 From: Nicolas Vuillamy Date: Sun, 26 May 2024 15:11:20 +0200 Subject: [PATCH] Automate test & release via GitHub Actions - Automate Releases via GitHub Actions - From `master` branch: **beta** - From `alpha` branch: **alpha** - When a GitHub release is created: Git tag selected for the release. - Run tests during Pull Request checks Will need NPM_TOKEN to be set to work --- .github/workflows/deploy-ALPHA.yml | 49 +++++++++++++++++++++++++++ .github/workflows/deploy-BETA.yml | 50 ++++++++++++++++++++++++++++ .github/workflows/deploy-RELEASE.yml | 46 +++++++++++++++++++++++++ .github/workflows/test.yml | 26 +++++++++++++++ CHANGELOG.md | 17 ++++++++++ 5 files changed, 188 insertions(+) create mode 100644 .github/workflows/deploy-ALPHA.yml create mode 100644 .github/workflows/deploy-BETA.yml create mode 100644 .github/workflows/deploy-RELEASE.yml create mode 100644 .github/workflows/test.yml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/deploy-ALPHA.yml b/.github/workflows/deploy-ALPHA.yml new file mode 100644 index 0000000..2bad0c2 --- /dev/null +++ b/.github/workflows/deploy-ALPHA.yml @@ -0,0 +1,49 @@ +--- +# +# Documentation: +# https://help.github.com/en/articles/workflow-syntax-for-github-actions +# + +####################################### +# Start the job on all push to master # +####################################### +name: 'Build & Deploy - Alpha' +on: + push: + branches: + - alpha + +permissions: read-all + +concurrency: + group: ${{ github.ref_name }}-${{ github.workflow }} + cancel-in-progress: true + +############### +# Set the Job # +############### +jobs: + + # Deploy to NPM + deploy_to_npm: + name: Deploy to NPM (beta) + runs-on: ubuntu-latest + permissions: read-all + environment: + name: alpha + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3.8.1 + with: + node-version: "18.x" + registry-url: "https://registry.npmjs.org" + scope: rubenhalman + - run: npm ci + - run: | + git config --global user.name nvuillam + git config --global user.email nicolas.vuillamy@gmail.com + - run: ALPHAID=$(date '+%Y%m%d%H%M') && npm version prerelease --preid="alpha$ALPHAID" + shell: bash + - run: npm publish --tag alpha + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/deploy-BETA.yml b/.github/workflows/deploy-BETA.yml new file mode 100644 index 0000000..bcaf2a7 --- /dev/null +++ b/.github/workflows/deploy-BETA.yml @@ -0,0 +1,50 @@ +--- +# +# Documentation: +# https://help.github.com/en/articles/workflow-syntax-for-github-actions +# + +####################################### +# Start the job on all push to master # +####################################### +name: 'Build & Deploy - Beta' +on: + push: + branches: + - main + - master + +permissions: read-all + +concurrency: + group: ${{ github.ref_name }}-${{ github.workflow }} + cancel-in-progress: true + +############### +# Set the Job # +############### +jobs: + + # Deploy to NPM + deploy_to_npm: + name: Deploy to NPM (beta) + runs-on: ubuntu-latest + permissions: read-all + environment: + name: beta + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3.8.1 + with: + node-version: "18.x" + registry-url: "https://registry.npmjs.org" + scope: rubenhalman + - run: npm ci + - run: | + git config --global user.name nvuillam + git config --global user.email nicolas.vuillamy@gmail.com + - run: BETAID=$(date '+%Y%m%d%H%M') && npm version prerelease --preid="beta$BETAID" + shell: bash + - run: npm publish --tag beta + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/deploy-RELEASE.yml b/.github/workflows/deploy-RELEASE.yml new file mode 100644 index 0000000..d4e3688 --- /dev/null +++ b/.github/workflows/deploy-RELEASE.yml @@ -0,0 +1,46 @@ +--- +# +# Documentation: +# https://help.github.com/en/articles/workflow-syntax-for-github-actions +# + +####################################### +# Start the job on all push to master # +####################################### +name: 'Build & Deploy - RELEASE' +on: + release: + # Want to run the automation when a release is created + types: ['created'] + +permissions: read-all + +concurrency: + group: ${{ github.ref_name }}-${{ github.workflow }} + cancel-in-progress: true + +############### +# Set the Job # +############### +jobs: + deploy_to_npm: + name: Deploy to NPM (release) + runs-on: ubuntu-latest + permissions: read-all + environment: + name: release + steps: + - uses: actions/checkout@v4 + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v3.8.1 + with: + node-version: "18.x" + registry-url: "https://registry.npmjs.org" + scope: rubenhalman + - run: npm ci + - run: | + git config --global user.name nvuillam + git config --global user.email nicolas.vuillamy@gmail.com + - run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..8128ad3 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,26 @@ +name: Test + +on: [push, pull_request] + +permissions: read-all + +concurrency: + group: ${{ github.ref_name }}-${{ github.workflow }} + cancel-in-progress: true + +jobs: + test: + name: Test + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Install node + uses: actions/setup-node@v3 + with: + node-version: 18 + - name: Install dependencies and link + run: npm ci && npm link + - name: Run tests + run: npm run test diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a87681d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,17 @@ +# Changelog + +## beta + +_can be used with `lightning-flow-scanner-core@beta`_ + +- Automate Releases via GitHub Actions + - From `master` branch: **beta** + - From `alpha` branch: **alpha** + - When a GitHub release is created: Git tag selected for the release. +- Run tests during Pull Request checks + +## [3.16.0] 2024-05-12 + +- Consistent Parsing Across Platforms: We've unified parsing modules across platforms, ensuring consistent parsing of flows. This enhancement improves compatibility and developer workflows. +- Improved Developer Experience: Say goodbye to xml2js! We've directly integrated xmlbuilder2 into the core module, enabling direct manipulation of Flow XML files. Utilize xmlbuilder2's convert function for seamless XML-to-JavaScript object transformation, simplifying parsing within the core module. +- Robust Error Handling: Experience smoother development processes with our robust error handling. We've implemented resilient mechanisms for graceful handling of parsing errors. \ No newline at end of file