-
-
Notifications
You must be signed in to change notification settings - Fork 1
Pslb 4 ncs version example finalize and build for pslb #26
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
Changes from all commits
56cc53b
40c1c88
51b8e3e
275e8e2
8f39765
07e38c9
fc23d85
0d4969f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| name: Build code | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| on: | ||
|
|
||
| # Trigger on pushes to branches and pull requests | ||
| push: | ||
| branches: | ||
| - '**' | ||
|
|
||
| # Trigger on pull requests targeting the specified branch | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
| workflow_call: | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| container: ghcr.io/nrfconnect/sdk-nrf-toolchain:v3.0.2 | ||
| defaults: | ||
| run: | ||
| # Bash shell is needed to set toolchain related environment variables in docker container | ||
| # It is a workaround for GitHub Actions limitation https://github.com/actions/runner/issues/1964 | ||
| shell: bash | ||
| strategy: | ||
| matrix: | ||
| board: [nrf54l15dk/nrf54l15/cpuapp] # Add | ||
|
|
||
|
|
||
| steps: | ||
| - name: Checkout repository pslabel | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| path: pslabel | ||
|
|
||
| - name: Prepare west project | ||
| run: | | ||
| west init -l pslabel | ||
| west update -o=--depth=1 -n | ||
|
|
||
| - name: Build Firmware | ||
| working-directory: pslabel | ||
| run: | | ||
| west build app -b ${{ matrix.board }} | ||
|
|
||
| - name: Extract version and create prefix | ||
| run: | | ||
| MAJOR=$(grep VERSION_MAJOR pslabel/app/VERSION | awk -F'=' '{print $2}' | tr -d '\r' | xargs) | ||
| MINOR=$(grep VERSION_MINOR pslabel/app/VERSION | awk -F'=' '{print $2}' | tr -d '\r' | xargs) | ||
| PATCH=$(grep PATCHLEVEL pslabel/app/VERSION | awk -F'=' '{print $2}' | tr -d '\r' | xargs) | ||
| VERSION="${MAJOR}.${MINOR}.${PATCH}" | ||
| echo "PREFIX=${{ github.event.repository.name }}-v${VERSION}" >> $GITHUB_ENV | ||
|
|
||
| - name: Generate short SHA | ||
| uses: benjlevesque/short-sha@v3.0 | ||
|
|
||
| - name: Prepare artifacts | ||
| run: | | ||
| cd pslabel/build | ||
| mkdir -p artifacts | ||
| mv merged.hex artifacts/${{ env.PREFIX }}-${{ env.SHA }}.hex | ||
| if [ -f dfu_application.zip ]; then | ||
| mv dfu_application.zip artifacts/${{ env.PREFIX }}-FOTA-${{ env.SHA }}.zip | ||
| fi | ||
|
|
||
| # Run IDs are unique per repo but are reused on re-runs | ||
| - name: Save artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: build_artifacts_${{ github.run_id }} | ||
| path: | | ||
| pslabel/build/artifacts/* | ||
| Original file line number | Diff line number | Diff line change | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,81 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Create Release | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| concurrency: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| group: ${{ github.workflow }}-${{ github.ref }} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cancel-in-progress: true | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| push: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| tags: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - 'v*.*.*' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # workflow_dispatch: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # inputs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # version: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # description: "Release Version." | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # required: true | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # default: "v0.0.0" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # type: string | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| stage-release: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: write-all | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outputs: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| version: ${{ steps.read_version.outputs.VERSION }} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repo | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Read version from VERSION file | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: read_version | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MAJOR=$(grep VERSION_MAJOR app/VERSION | awk -F'=' '{print $2}' | tr -d '\r' | xargs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| MINOR=$(grep VERSION_MINOR app/VERSION | awk -F'=' '{print $2}' | tr -d '\r' | xargs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PATCH=$(grep PATCHLEVEL app/VERSION | awk -F'=' '{print $2}' | tr -d '\r' | xargs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VERSION="v${MAJOR}.${MINOR}.${PATCH}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "file_version=$VERSION" >> $GITHUB_OUTPUT | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # - name: Create Release manually with GH CLI | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # if: ${{ github.event_name == 'workflow_dispatch' }} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # run: gh release create --draft ${{ steps.read_version.outputs.VERSION }} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # env: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Fail if tag and VERSION mismatch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TAG_VERSION="${GITHUB_REF##*/}" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Tag pushed: $TAG_VERSION" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Internal version: $FILE_VERSION" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$TAG_VERSION" != "$FILE_VERSION" ]; then | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "❌ ERROR: Tag ($TAG_VERSION) does not match VERSION file ($FILE_VERSION)" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "✅ Tag and VERSION file match." | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| FILE_VERSION: ${{ steps.read_version.outputs.file_version }} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build-binaries: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: stage-release | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: ./.github/workflows/build.yml | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| upload-binaries: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+60
to
+63
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Copilot AutofixAI 10 months ago To fix the issue, we will add a
Suggested changeset
1
.github/workflows/release.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: [build-binaries, stage-release] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: write-all | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repo | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Download artifact | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/download-artifact@v4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: build_artifacts_${{ github.run_id }} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: ~/artifacts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Upload artifacts to release | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: gh release upload --clobber ${{ needs.stage-release.outputs.version }} ~/artifacts/*.* | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 10 months ago
To fix the issue, we will explicitly add a
permissionsblock to the workflow. The permissions block will limit theGITHUB_TOKENaccess to only the permissions required for the workflow's operations. Based on the tasks in the workflow (checking out the repository, building firmware, preparing artifacts, and uploading artifacts), the following permissions will be set:contents: read— Required for reading repository contents (e.g., actions/checkout).actions: write— Required for uploading artifacts (actions/upload-artifact).The
permissionsblock will be added at the root of the workflow, ensuring that all jobs inherit these minimal permissions unless overridden.