Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflows for the migration to Artifactory #971

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .github/actions/build-action/action.yml

This file was deleted.

18 changes: 0 additions & 18 deletions .github/actions/publish-action/action.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/build-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build App

on:
workflow_call:
inputs:
ref:
type: string
Comment on lines +6 to +7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to not make this required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the build workflow the default is always correct. For the release workflow the default will be correct most of the time. So we only need to override occasionally.

force_pack:
type: boolean
Comment on lines +8 to +9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering where the comes from (at least I couldn't see it being passed in the workflow using this in RSSI)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: actions/[email protected]
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
15 changes: 0 additions & 15 deletions .github/workflows/build.yml

This file was deleted.

97 changes: 48 additions & 49 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -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="<!--labels-->"
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="<!--labels-->"
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.')
40 changes: 40 additions & 0 deletions .github/workflows/release-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
workflow_call:
inputs:
ref:
type: string
Comment on lines +6 to +7
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the other comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the reasoning is similar: When releasing the latest commit to the latest source, the default ref is always correct. When releasing manually to a specified source the default (latest commit on main) also seems like a good idea unless you explicitly want to specify something else.

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 }}
50 changes: 0 additions & 50 deletions .github/workflows/release.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/test-shared.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
node-version: 22
cache: 'npm'
- run: npm ci
- run: npm run check
- run: npm test
- run: npm pack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is packing necessary here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not really necessary, but I try to do as many steps towards releasing without actually releasing to check whether anything might go wrong if we want to release.

11 changes: 7 additions & 4 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down