-
Notifications
You must be signed in to change notification settings - Fork 1
synchronize source code with Artifactory #1
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
# action-src-mirror | ||
Synchronize files between repository and Artifactory | ||
Checkout, pack, and upload source code to Artifactory | ||
|
||
|
||
Example: | ||
|
||
``` | ||
- name: Sync source to Artifactory | ||
uses: nrfconnect/action-src-mirror@main | ||
with: | ||
git-ref: ${{ github.ref_name }} | ||
git-fetch-depth: '0' | ||
path: 'workspace/nrf' | ||
west-update-args: '--group-filter=+babblesim' | ||
artifactory-url: 'https://eu.files.nordicsemi.com/artifactory' | ||
artifactory-repository: 'ncs-src-mirror' | ||
artifactory-target-prefix: 'external' | ||
artifactory-user: ${{ secrets.COM_NORDICSEMI_FILES_USERNAME }} | ||
artifactory-pass: ${{ secrets.COM_NORDICSEMI_FILES_PASSWORD }} | ||
``` |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: 'Synchronize Source' | ||
description: 'Checkout, pack, and upload source code to Artifactory' | ||
inputs: | ||
git-ref: | ||
description: 'Branch, tag or SHA to checkout' | ||
required: true | ||
jaci-nordic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
git-fetch-depth: | ||
description: 'Git fetch depth (0 = full history, 1 = shallow)' | ||
required: false | ||
default: '0' | ||
path: | ||
description: 'Directory to checkout sources into' | ||
required: false | ||
default: '' | ||
west-update-args: | ||
description: 'Arguments to pass to `west update`' | ||
required: false | ||
default: '' | ||
artifactory-url: | ||
description: 'Base URL of Artifactory' | ||
required: false | ||
default: 'https://eu.files.nordicsemi.com/artifactory' | ||
artifactory-repository: | ||
description: 'Artifactory repository name' | ||
required: false | ||
default: 'ncs-src-mirror' | ||
artifactory-target-prefix: | ||
description: 'Prefix path in Artifactory (e.g., external)' | ||
required: true | ||
default: '' | ||
artifactory-target-file-name: | ||
description: 'Source file name in Artifactory ' | ||
required: false | ||
artifactory-user: | ||
description: 'Artifactory username (pass as workflow secret)' | ||
required: true | ||
artifactory-pass: | ||
description: 'Artifactory password or API key (pass as workflow secret)' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Checkout sources | ||
uses: nrfconnect/action-checkout-west-update@main | ||
with: | ||
git-ref: ${{ inputs.git-ref }} | ||
git-fetch-depth: ${{ inputs.git-fetch-depth }} | ||
path: workspace/${{ inputs.path }} | ||
west-update-args: ${{ inputs.west-update-args }} | ||
|
||
|
||
- name: Configure git and run garbage collection | ||
shell: bash | ||
run: | | ||
cd "workspace/${{ inputs.path }}" | ||
git config --global pack.windowMemory "32m" | ||
west forall -c 'git gc --prune --aggressive' | ||
|
||
- name: Create tar archive | ||
shell: bash | ||
run: | | ||
REPO_NAME="${GITHUB_REPOSITORY##*/}" | ||
TAG="${GITHUB_REF_NAME}" | ||
FILE_NAME="${REPO_NAME}-${TAG}.tar.gz" | ||
tar -C "workspace" -czvf "${FILE_NAME}" . | ||
|
||
- name: Set up JFrog CLI | ||
uses: jfrog/setup-jfrog-cli@v4 | ||
|
||
- name: Upload to Artifactory | ||
shell: bash | ||
env: | ||
ARTIFACTORY_URL: ${{ inputs.artifactory-url }} | ||
REPOSITORY: ${{ inputs.artifactory-repository }} | ||
TARGET_PREFIX: ${{ inputs.artifactory-target-prefix }} | ||
USER: ${{ inputs.artifactory-user }} | ||
PASS: ${{ inputs.artifactory-pass }} | ||
run: | | ||
REPO_NAME="${GITHUB_REPOSITORY##*/}" | ||
TAG="${GITHUB_REF_NAME}" | ||
FILE_NAME="${REPO_NAME}-${TAG}.tar.gz" | ||
TARGET_DIR="${REPOSITORY}/${TARGET_PREFIX}/${TAG}/" | ||
if [ -n "${{ inputs.artifactory-target-file-name }}" ]; then | ||
UPLOAD_NAME="${{ inputs.artifactory-target-file-name }}" | ||
else | ||
UPLOAD_NAME="${FILE_NAME}" | ||
fi | ||
jfrog rt u "${FILE_NAME}" "${TARGET_DIR}${UPLOAD_NAME}" \ | ||
--url="${ARTIFACTORY_URL}" \ | ||
--user="${USER}" \ | ||
--password="${PASS}" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.