From 0692436769d8957437ea0912ae78a9e4a2ce62cc Mon Sep 17 00:00:00 2001 From: Marko Schulz Date: Thu, 6 Feb 2025 17:49:27 +0100 Subject: [PATCH 1/5] Add Github Action to test pc-nrfconnect-shared This is currently still also done on Azure through azure-pipelines.yml, but the intention is to move this to Github Actions. --- .github/workflows/test-shared.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/test-shared.yml diff --git a/.github/workflows/test-shared.yml b/.github/workflows/test-shared.yml new file mode 100644 index 000000000..612f42865 --- /dev/null +++ b/.github/workflows/test-shared.yml @@ -0,0 +1,21 @@ +name: Test shared + +on: + workflow_dispatch: + pull_request: + push: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4.0.0 + with: + node-version: 22 + cache: 'npm' + - run: npm ci + - run: npm run check + - run: npm test + - run: npm pack From 4380f764a9b79f3c97220c697d01ef8655ca31e8 Mon Sep 17 00:00:00 2001 From: Marko Schulz Date: Thu, 6 Feb 2025 18:14:33 +0100 Subject: [PATCH 2/5] Make indentation consistent --- .github/workflows/labels.yml | 97 ++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 49 deletions(-) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index b83975fd2..c157751bf 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -1,61 +1,60 @@ name: Check labels -on: - workflow_call: +on: workflow_call env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ github.token }} jobs: check_label: runs-on: ubuntu-latest steps: - - name: 'Check for missing doc label' - if: > - ! contains(github.event.pull_request.labels.*.name, 'doc required') && - ! contains(github.event.pull_request.labels.*.name, 'doc not required') - run: echo "missing_doc_label=true" >> "$GITHUB_ENV" + - name: 'Check for missing doc label' + if: > + ! contains(github.event.pull_request.labels.*.name, 'doc required') && + ! contains(github.event.pull_request.labels.*.name, 'doc not required') + run: echo "missing_doc_label=true" >> "$GITHUB_ENV" - - name: 'Check for missing ui label' - if: > - ! contains(github.event.pull_request.labels.*.name, 'ui required') && - ! contains(github.event.pull_request.labels.*.name, 'ui not required') - run: echo "missing_ui_label=true" >> "$GITHUB_ENV" - - - name: 'Notify user if label(s) is missing' - if: > - (env.missing_doc_label == 'true' || - env.missing_ui_label == 'true') && - ! contains(github.event.pull_request.labels.*.name, 'documentation') - run: | - URL="${{ github.event.pull_request.html_url }}" - TAG_IDENTIFIER="" - COMMENT_TEXT="${TAG_IDENTIFIER}\nAdd labels:" - if [[ "${{ env.missing_doc_label }}" == 'true' ]]; then - COMMENT_TEXT="${COMMENT_TEXT}\n- 'doc required' or 'doc not required'" - fi - if [[ "${{ env.missing_ui_label }}" == 'true' ]]; then - COMMENT_TEXT="${COMMENT_TEXT}\n - - 'ui required' or 'ui not required'\n\n - For UI review:\n - - describe the changes\n - - add pictures\n - - add the relevant UI responsible(s) as a reviewer" - fi + - name: 'Check for missing ui label' + if: > + ! contains(github.event.pull_request.labels.*.name, 'ui required') && + ! contains(github.event.pull_request.labels.*.name, 'ui not required') + run: echo "missing_ui_label=true" >> "$GITHUB_ENV" - if [[ ! \ - $(gh pr view $URL \ - --json comments \ - --jq '.comments[].body | select(. | startswith("'"$TAG_IDENTIFIER"'"))') \ - ]]; then - gh pr comment $URL --body "$(echo -e $COMMENT_TEXT)" - fi + - name: 'Notify user if label(s) is missing' + if: > + (env.missing_doc_label == 'true' || + env.missing_ui_label == 'true') && + ! contains(github.event.pull_request.labels.*.name, 'documentation') + run: | + URL="${{ github.event.pull_request.html_url }}" + TAG_IDENTIFIER="" + COMMENT_TEXT="${TAG_IDENTIFIER}\nAdd labels:" + if [[ "${{ env.missing_doc_label }}" == 'true' ]]; then + COMMENT_TEXT="${COMMENT_TEXT}\n- 'doc required' or 'doc not required'" + fi + if [[ "${{ env.missing_ui_label }}" == 'true' ]]; then + COMMENT_TEXT="${COMMENT_TEXT}\n + - 'ui required' or 'ui not required'\n\n + For UI review:\n + - describe the changes\n + - add pictures\n + - add the relevant UI responsible(s) as a reviewer" + fi - - name: 'Fail' - uses: actions/github-script@v7 - if: > - (env.missing_doc_label == 'true' || - env.missing_ui_label == 'true') && - ! contains(github.event.pull_request.labels.*.name, 'documentation') - with: - script: core.setFailed('Required doc and/or ui labels missing.') + if [[ ! \ + $(gh pr view $URL \ + --json comments \ + --jq '.comments[].body | select(. | startswith("'"$TAG_IDENTIFIER"'"))') \ + ]]; then + gh pr comment $URL --body "$(echo -e $COMMENT_TEXT)" + fi + + - name: 'Fail' + uses: actions/github-script@v7 + if: > + (env.missing_doc_label == 'true' || + env.missing_ui_label == 'true') && + ! contains(github.event.pull_request.labels.*.name, 'documentation') + with: + script: core.setFailed('Required doc and/or ui labels missing.') From 7aad4b350b46c70b4fc5d71c2e910dfbf1d2791f Mon Sep 17 00:00:00 2001 From: Marko Schulz Date: Fri, 7 Feb 2025 07:53:12 +0100 Subject: [PATCH 3/5] Simplify build app workflow The actions could just be inlined and stripped of unnecessary elements. --- .github/actions/build-action/action.yml | 22 -------------- .github/actions/publish-action/action.yml | 18 ------------ .github/workflows/build-app.yml | 35 +++++++++++++++++++++++ .github/workflows/build.yml | 15 ---------- 4 files changed, 35 insertions(+), 55 deletions(-) delete mode 100644 .github/actions/build-action/action.yml delete mode 100644 .github/actions/publish-action/action.yml create mode 100644 .github/workflows/build-app.yml delete mode 100644 .github/workflows/build.yml diff --git a/.github/actions/build-action/action.yml b/.github/actions/build-action/action.yml deleted file mode 100644 index 1565ced11..000000000 --- a/.github/actions/build-action/action.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Build nRF Connect for Desktop - -runs: - using: 'composite' - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: 'npm' - - name: Install Dependencies - shell: bash - run: npm ci - - name: Run all checks - shell: bash - run: npm run check - - name: Run Tests - shell: bash - run: npm test - - name: Build for Production - shell: bash - run: npm run build:prod diff --git a/.github/actions/publish-action/action.yml b/.github/actions/publish-action/action.yml deleted file mode 100644 index 537fa4f5a..000000000 --- a/.github/actions/publish-action/action.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Publish nRF Connect for Desktop - -inputs: - suffix: - type: string - required: true - -runs: - using: 'composite' - steps: - - name: Pack - shell: bash - run: npm pack - - name: Publish built artifact - uses: actions/upload-artifact@v4 - with: - path: ./*.tgz - retention-days: 3 diff --git a/.github/workflows/build-app.yml b/.github/workflows/build-app.yml new file mode 100644 index 000000000..069d220b8 --- /dev/null +++ b/.github/workflows/build-app.yml @@ -0,0 +1,35 @@ +name: Build App + +on: + workflow_call: + inputs: + ref: + type: string + force_pack: + type: boolean + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ inputs.ref }} + - uses: actions/setup-node@v4.0.0 + with: + node-version: 22 + cache: 'npm' + - run: npm ci + - run: npm run check + - run: npm test + - run: npm run build:prod + - run: npm pack + if: + github.event.push.ref == 'refs/heads/main' || + inputs.force_pack + - uses: actions/upload-artifact@v4 + with: + path: ./*.tgz + if: + github.event.push.ref == 'refs/heads/main' || + inputs.force_pack diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 405882d79..000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,15 +0,0 @@ - -name: Build App - -on: - workflow_call - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Build - uses: NordicSemiconductor/pc-nrfconnect-shared/.github/actions/build-action@main - - name: Publish artifacts - uses: NordicSemiconductor/pc-nrfconnect-shared/.github/actions/publish-action@main - if: github.event_name != 'pull_request' From 19b8bec0630db4292f6c2c68a09e3e494d65bf0f Mon Sep 17 00:00:00 2001 From: Marko Schulz Date: Fri, 7 Feb 2025 08:43:02 +0100 Subject: [PATCH 4/5] Release apps to Artifactory --- .github/workflows/release-app.yml | 40 +++++++++++++++++++++++++ .github/workflows/release.yml | 50 ------------------------------- 2 files changed, 40 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/release-app.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release-app.yml b/.github/workflows/release-app.yml new file mode 100644 index 000000000..831e7fcc7 --- /dev/null +++ b/.github/workflows/release-app.yml @@ -0,0 +1,40 @@ +name: Release + +on: + workflow_call: + inputs: + ref: + type: string + source: + required: true + type: string + access_level: + required: true + type: string + +jobs: + build: + uses: ./.github/workflows/build-app.yml + with: + ref: ${{ inputs.ref }} + force_pack: true + + release: + runs-on: ubuntu-latest + needs: build + environment: + name: ${{ inputs.source }} + + steps: + - uses: actions/download-artifact@v4 + - env: + ARTIFACTORY_TOKEN: + ${{ secrets.COM_NORDICSEMI_FILES_USERNAME }} + run: | + cd artifact + tar xaf *.tgz --strip-components 1 + node dist/nordic-publish.js \ + --no-pack \ + --destination artifactory \ + --access-level ${{ inputs.access_level }} \ + --source ${{ inputs.source }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 2a1954489..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Release - -on: - workflow_dispatch: - inputs: - run_id: - description: 'The workflow id where the artifacts were uploaded' - required: true - type: string - tag: - description: 'Tag to be used (e.g. v1.2.3)' - required: true - type: string - source: - description: 'What source to release to' - required: true - type: string - - -env: - GH_TOKEN: ${{ github.token }} - -jobs: - release: - runs-on: 'ubuntu-latest' - steps: - - name: Download artifacts - run: > - gh run download ${{ inputs.run_id }} - --repo ${{ github.event.repository.full_name }} - - name: list files - run: ls -lR - - name: Get access to publish script in Node Modules - run: > - tar xzvf *.tgz && - cd package && - mv ../*.tgz . - - name: Run Publish Script from @Shared - run: ls -lR && npm run nordic-publish -- -n -s ${{ inputs.source }} - - name: Create official release on GitHub - if: ${{ inputs.source }} == 'official' - run: > - gh release create ${{ inputs.tag }} - --repo ${{ github.event.repository.full_name }} - --title ${{ inputs.tag }} - --draft - --generate-notes - ./*.tgz - - From 4a009dddb4de7502b2a6b1e135977f0ba4e84b94 Mon Sep 17 00:00:00 2001 From: Marko Schulz Date: Fri, 7 Feb 2025 15:00:24 +0100 Subject: [PATCH 5/5] Describe change --- Changelog.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index f604b6be4..942b37071 100644 --- a/Changelog.md +++ b/Changelog.md @@ -11,17 +11,20 @@ every new version is a new major version. ### Added -- Support for publishing apps to Artifactory +- Support for publishing apps to Artifactory. ### Fixed - Product links for nRF54L15 DK, nRF54H20 DK, nRF9131 EK, nRF9151 DK, nRF9161 - DK, and Nordic Thingy:91 X + DK, and Nordic Thingy:91 X. ### Steps to upgrade when using this package -- Where the nordic-publish script is called (usually in the azure release - pipeline), add the parameter `--destination ftp`. +- When publishing the app via FTP (usually in the azure release pipeline), add + the parameter `--destination ftp` when calling the nordic-publish script. +- Copy the files `build.yml`, `release.yml`, and `release-latest.yml` from + https://github.com/NordicSemiconductor/pc-nrfconnect-boilerplate/tree/main/.github/workflows + to `.github/workflows`. ## 197.0.0 - 2025-02-05