-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from NIDAP-Community/release_dev
CI/CD and latest code update
- Loading branch information
Showing
39 changed files
with
2,435 additions
and
210 deletions.
There are no files selected for viewing
This file contains 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,105 @@ | ||
name: Manual Deployment to NIDAP | ||
run-name: Manual Deployment to NIDAP by ${{ github.actor }} | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
|
||
image_to_use: | ||
required: true | ||
default: "<Replace with your image>" | ||
type: string | ||
|
||
package_to_deploy: | ||
required: true | ||
type: string | ||
|
||
artifact_rid: | ||
required: true | ||
default: "<Replace with your artifact RID>" | ||
type: string | ||
|
||
token_to_use: | ||
required: true | ||
type: string | ||
|
||
|
||
jobs: | ||
Adding_documentation_files_and_publish_page: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ${{ inputs.image_to_use }} | ||
credentials: | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
steps: | ||
- run: echo "Checking in ${{ inputs.image_to_use }}" | ||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Continuous Deployment to NIDAP | ||
id: nidap-cd | ||
run: | | ||
export current_wd="/__w/${GITHUB_REPOSITORY#*/}/${GITHUB_REPOSITORY#*/}" | ||
cd $current_wd | ||
export MY_GIT_TOKEN=${{ secrets.GITHUB_TOKEN }} | ||
export MY_GIT_USERNAME=${{ github.actor }} | ||
export MY_GIT_EMAIL=${{ github.event.pusher.email }} | ||
git config --global user.name "$MY_GIT_USERNAME" | ||
git config --global user.email "$MY_GIT_EMAIL" | ||
git config --global url."https://api:[email protected]/".insteadOf "https://github.com/" | ||
git config --global url."https://ssh:[email protected]/".insteadOf "ssh://[email protected]/" | ||
git config --global url."https://git:[email protected]/".insteadOf "[email protected]:" | ||
git config --global --add safe.directory "$current_wd" | ||
git clone https://github.com/${GITHUB_REPOSITORY}.git | ||
cd ${GITHUB_REPOSITORY#*/} | ||
BRANCH_NAME="Conda_Package" | ||
git checkout $BRANCH_NAME | ||
echo "########## Git setup complete, moving to deployment... ##########" | ||
conda install curl | ||
current_pkg="${{ inputs.package_to_deploy }}" | ||
echo "Package to Upload: $current_pkg" | ||
TOKEN="${{ inputs.token_to_use }}" | ||
PACKAGE="$current_pkg" | ||
PLATFORM="linux-64" # replace with the package platform (e.g. noarch, linux-64, osx-64) | ||
response=$(curl \ | ||
-H "Authorization: Bearer $TOKEN" \ | ||
-H "Content-Type: application/octet-stream" \ | ||
--data-binary "@$PACKAGE" \ | ||
-XPUT "https://nidap.nih.gov/artifacts/api/repositories/${{ inputs.artifact_rid }}/contents/release/conda/$PLATFORM/$PACKAGE" \ | ||
2>&1) | ||
echo "#########################################################" | ||
current_datetime="$(date +"%Y-%m-%d %H:%M:%S")" | ||
# Check if the response contains an error message | ||
if echo "$response" | grep -q "errorCode"; then | ||
status=$(echo "$response" | grep -o '"errorName":"[^"]*' | awk -F'"' '{print $4}') | ||
echo "Error message: $status" | ||
echo "<br>Deployment Time: $current_datetime; Deployment Status: $status" >> README.md | ||
else | ||
status="Success" | ||
echo "Update Success!" | ||
echo "Package ${{ env.current_pkg }} is now on NIDAP." | ||
echo "<br>Deployment Time: $current_datetime; Deployment Status: Success" >> README.md | ||
fi | ||
git commit -a -m "Deployment Performed on $current_datetime with Status: $status." | ||
git push -f origin $BRANCH_NAME |
This file contains 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,17 +1,23 @@ | ||
name: Gitflow Action for R Package Development | ||
run-name: ${{ github.actor }} now ${{ github.event_name }} to ${{ github.ref_name }} | ||
run-name: ${{ github.actor }} ${{ github.event_name }} to ${{ github.ref_name }} | ||
|
||
on: | ||
push: | ||
branches: ['*', '!dev', '!main'] | ||
branches: ['*', '!dev', '!main', '!release_dev', '!Conda_Package', '!github_page'] | ||
|
||
pull_request: | ||
types: ['opened', 'closed'] | ||
branches: ['main', 'release*'] | ||
|
||
jobs: | ||
Activating_Parser: | ||
uses: fnlcr-bids-sdsi/gitflow-R/.github/workflows/parser.yml@DSPWorkflow | ||
uses: fnlcr-bids-sdsi/gitflow-R/.github/workflows/parser.yml@master | ||
with: | ||
image_to_use: ghcr.io/nidap-community/dsp_github_workflow_env:DSPv0.9.5 | ||
|
||
image_to_use: ghcr.io/nidap-community/dsp_ci_cd:latest | ||
package_name: "r-dspworkflow" | ||
r_version: "4.1.3" | ||
artifact_rid_production: "ri.artifacts.main.repository.32a4b1e5-fb24-41a2-a552-fa252206e981" | ||
artifact_rid_development: "ri.stemma.main.repository.2172e505-c98f-43d4-881a-47e170aadbe1" | ||
secrets: | ||
NIDAP_TOKEN_PRODUCTION: ${{ secrets.NIDAP_TOKEN_PRODUCTION }} | ||
NIDAP_TOKEN_DEVELOPMENT: ${{ secrets.NIDAP_TOKEN_DEVELOPMENT }} |
Oops, something went wrong.