forked from tardis-sn/tardis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split release pipeline (tardis-sn#1142)
* Initial commit [skip ci] * Skip CI when updating JSON. Move to azure-pipelines folder * Split release pipeline * Comment PR trigger * Uncomment PR trigger
- Loading branch information
Showing
2 changed files
with
129 additions
and
109 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 |
---|---|---|
|
@@ -15,123 +15,14 @@ schedules: | |
|
||
variables: | ||
system.debug: "true" | ||
tardis.zenodo.home: "$(Agent.BuildDirectory)/tardis_zenodo" | ||
tardis.zenodo.access: $(epassaro_pat) | ||
tardis.build.dir: $(Build.Repository.LocalPath) | ||
|
||
pool: | ||
vmImage: "ubuntu-latest" | ||
|
||
jobs: | ||
- job: zenodo_json | ||
displayName: Create Zenodo JSON file | ||
steps: | ||
|
||
- task: DownloadSecureFile@1 | ||
inputs: | ||
secureFile: 'id_azure_rsa' | ||
|
||
- task: InstallSSHKey@0 | ||
inputs: | ||
knownHostsEntry: $(gh_host) | ||
sshPublicKey: $(public_key) | ||
sshKeySecureFile: 'id_azure_rsa' | ||
|
||
- task: DownloadSecureFile@1 | ||
name: zenodoSecretKey | ||
displayName: "Download Zenodo secret key" | ||
inputs: | ||
secureFile: "key_secret.json" | ||
|
||
- task: DownloadSecureFile@1 | ||
name: authorOrder | ||
displayName: "Download author order file" | ||
inputs: | ||
secureFile: "author_order.txt" | ||
|
||
- task: DownloadSecureFile@1 | ||
name: nonCommitContributors | ||
displayName: "Download non commit contributors file" | ||
inputs: | ||
secureFile: "non_commit_contributors.txt" | ||
|
||
- bash: | | ||
echo "##vso[task.prependpath]$CONDA/bin" | ||
sudo chown -R $USER $CONDA | ||
displayName: "Add CONDA to path" | ||
- bash: | | ||
conda create -n zenodo python=3.6 --yes | ||
source activate zenodo | ||
conda install jupyter nbconvert numpy pandas orcid -c conda-forge --yes | ||
displayName: "Create Zenodo env" | ||
- bash: | | ||
cd .. | ||
git clone https://$(tardis.zenodo.access)@github.com/tardis-sn/tardis_zenodo.git | ||
displayName: "Clone tardis_zenodo repo" | ||
- bash: | | ||
cp $(zenodoSecretKey.secureFilePath) $(tardis.zenodo.home) | ||
cp $(authorOrder.secureFilePath) $(tardis.zenodo.home) | ||
cp $(nonCommitContributors.secureFilePath) $(tardis.zenodo.home) | ||
displayName: "Recovering secrets" | ||
- bash: | | ||
source activate zenodo | ||
cd $(tardis.zenodo.home) | ||
jupyter nbconvert gather_data.ipynb --to html --allow-errors --execute --ExecutePreprocessor.timeout=6000 | ||
displayName: "Running notebook (allow errors)" | ||
- bash: | | ||
source activate zenodo | ||
cd $(tardis.zenodo.home) | ||
jupyter nbconvert gather_data.ipynb --to html --execute --ExecutePreprocessor.timeout=6000 | ||
displayName: "Running notebook (not allow errors)" | ||
# This step should fail if there are changes in .zenodo.json | ||
#- bash: | | ||
# diff $(tardis.zenodo.home)/.zenodo.json .zenodo.json | ||
# displayName: "Look for changes in JSON" | ||
|
||
- bash: | | ||
set -e | ||
cd .. | ||
git clone [email protected]:tardis-sn/tardis.git out | ||
cd out | ||
git config --local user.name "Azure Pipelines" | ||
git config --local user.email "[email protected]" | ||
cp $(tardis.zenodo.home)/.zenodo.json .zenodo.json | ||
git add .zenodo.json | ||
if git diff --staged --quiet; then | ||
echo "Exiting with no changes" | ||
exit 0 | ||
else | ||
git commit -m "Update zenodo.json" | ||
git push origin master | ||
fi | ||
displayName: "Push zenodo.json to master branch" | ||
- task: PublishPipelineArtifact@1 | ||
inputs: | ||
targetPath: "$(tardis.zenodo.home)/.zenodo.json" | ||
artifact: "zenodo_json" | ||
publishLocation: "pipeline" | ||
condition: succeededOrFailed() | ||
|
||
- task: PublishPipelineArtifact@1 | ||
inputs: | ||
targetPath: "$(tardis.zenodo.home)/gather_data.html" | ||
artifact: "report" | ||
publishLocation: "pipeline" | ||
condition: succeededOrFailed() | ||
|
||
- job: gh_release | ||
displayName: Upload GitHub release | ||
dependsOn: zenodo_json | ||
steps: | ||
- bash: | | ||
echo "##vso[task.prependpath]$CONDA/bin" | ||
|
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,129 @@ | ||
# Starter pipeline | ||
# Start with a minimal pipeline that you can customize to build and deploy your code. | ||
# Add steps that build, run tests, deploy, and more: | ||
# https://aka.ms/yaml | ||
|
||
trigger: none | ||
pr: none | ||
schedules: | ||
- cron: "30 22 * * 5" | ||
displayName: Weekly update | ||
branches: | ||
include: | ||
- master | ||
always: true | ||
|
||
variables: | ||
system.debug: "true" | ||
tardis.zenodo.home: "$(Agent.BuildDirectory)/tardis_zenodo" | ||
tardis.zenodo.access: $(epassaro_pat) | ||
tardis.build.dir: $(Build.Repository.LocalPath) | ||
|
||
pool: | ||
vmImage: "ubuntu-latest" | ||
|
||
jobs: | ||
- job: zenodo_json | ||
displayName: Create Zenodo JSON file | ||
steps: | ||
- task: DownloadSecureFile@1 | ||
inputs: | ||
secureFile: "id_azure_rsa" | ||
|
||
- task: InstallSSHKey@0 | ||
inputs: | ||
knownHostsEntry: $(gh_host) | ||
sshPublicKey: $(public_key) | ||
sshKeySecureFile: "id_azure_rsa" | ||
|
||
- task: DownloadSecureFile@1 | ||
name: zenodoSecretKey | ||
displayName: "Download Zenodo secret key" | ||
inputs: | ||
secureFile: "key_secret.json" | ||
|
||
- task: DownloadSecureFile@1 | ||
name: authorOrder | ||
displayName: "Download author order file" | ||
inputs: | ||
secureFile: "author_order.txt" | ||
|
||
- task: DownloadSecureFile@1 | ||
name: nonCommitContributors | ||
displayName: "Download non commit contributors file" | ||
inputs: | ||
secureFile: "non_commit_contributors.txt" | ||
|
||
- bash: | | ||
echo "##vso[task.prependpath]$CONDA/bin" | ||
sudo chown -R $USER $CONDA | ||
displayName: "Add CONDA to path" | ||
- bash: | | ||
conda create -n zenodo python=3.6 --yes | ||
source activate zenodo | ||
conda install jupyter nbconvert numpy pandas orcid -c conda-forge --yes | ||
displayName: "Create Zenodo env" | ||
- bash: | | ||
cd .. | ||
git clone https://$(tardis.zenodo.access)@github.com/tardis-sn/tardis_zenodo.git | ||
displayName: "Clone tardis_zenodo repo" | ||
- bash: | | ||
cp $(zenodoSecretKey.secureFilePath) $(tardis.zenodo.home) | ||
cp $(authorOrder.secureFilePath) $(tardis.zenodo.home) | ||
cp $(nonCommitContributors.secureFilePath) $(tardis.zenodo.home) | ||
displayName: "Recovering secrets" | ||
- bash: | | ||
source activate zenodo | ||
cd $(tardis.zenodo.home) | ||
jupyter nbconvert gather_data.ipynb --to html --allow-errors --execute --ExecutePreprocessor.timeout=6000 | ||
displayName: "Running notebook (allow errors)" | ||
- bash: | | ||
source activate zenodo | ||
cd $(tardis.zenodo.home) | ||
jupyter nbconvert gather_data.ipynb --to html --execute --ExecutePreprocessor.timeout=6000 | ||
displayName: "Running notebook (not allow errors)" | ||
# This step should fail if there are changes in .zenodo.json | ||
#- bash: | | ||
# diff $(tardis.zenodo.home)/.zenodo.json .zenodo.json | ||
# displayName: "Look for changes in JSON" | ||
|
||
- bash: | | ||
set -e | ||
cd .. | ||
git clone [email protected]:tardis-sn/tardis.git out | ||
cd out | ||
git config --local user.name "Azure Pipelines" | ||
git config --local user.email "[email protected]" | ||
cp $(tardis.zenodo.home)/.zenodo.json .zenodo.json | ||
git add .zenodo.json | ||
if git diff --staged --quiet; then | ||
echo "Exiting with no changes" | ||
exit 0 | ||
else | ||
git commit -m "Update zenodo.json [skip ci]" | ||
git push origin master | ||
fi | ||
displayName: "Push zenodo.json to master branch" | ||
- task: PublishPipelineArtifact@1 | ||
inputs: | ||
targetPath: "$(tardis.zenodo.home)/.zenodo.json" | ||
artifact: "zenodo_json" | ||
publishLocation: "pipeline" | ||
condition: succeededOrFailed() | ||
|
||
- task: PublishPipelineArtifact@1 | ||
inputs: | ||
targetPath: "$(tardis.zenodo.home)/gather_data.html" | ||
artifact: "report" | ||
publishLocation: "pipeline" | ||
condition: succeededOrFailed() |