Skip to content

Commit

Permalink
Add GitHub Release to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaspustina committed Apr 22, 2020
1 parent 5551b93 commit 63fbe5a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 36 deletions.
65 changes: 29 additions & 36 deletions .ci/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,39 +141,32 @@ stages:
artifact_names:
- aws-watchtower

# - stage: Publish_Release
# displayName: "Publish Release"
# dependsOn: Build_Release_Artefacts
# condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')
# jobs:
# - job: 'Publish_To_GitHub'
# displayName: "Publish to GitHub"
# steps:
# # Shortcut 'download' cannot be used as it does not restore into the original path; cf. https://docs.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts?view=azure-devops&tabs=yaml#downloading-artifacts
# - task: DownloadPipelineArtifact@2
# inputs:
# buildType: 'current'
# artifactName: 'Static_Linux_Binary'
# targetPath: '$(Build.ArtifactStagingDirectory)'
# displayName: "Download Static Linux Binary"
# - script: |
# ls -al $BUILD_ARTIFACTSTAGINGDIRECTORY && \
# mv "$BUILD_ARTIFACTSTAGINGDIRECTORY/${CRATE_BIN_NAME}" "$BUILD_ARTIFACTSTAGINGDIRECTORY/${CRATE_BIN_NAME}-$AGENT_OSARCHITECTURE-musl-static" && \
# ls -al $BUILD_ARTIFACTSTAGINGDIRECTORY
# displayName: "Prepare Assets for Upload"
# - task: GitHubRelease@0
# displayName: "Create GitHub Release"
# inputs:
# gitHubConnection: 'lukaspustina-releaseupload'
# repositoryName: '$(Build.Repository.Name)'
# action: create
# target: '$(Build.SourceVersion)'
# tagSource: 'auto'
# tagPattern: 'v.*'
# tag: $(tagName)
# assets: $(Build.ArtifactStagingDirectory)/*
# assetUploadMode: 'delete'
# isDraft: false
# isPreRelease: false
# addChangeLog: true
# compareWith: 'lastFullRelease'
- stage: Publish_Release
displayName: "Publish Release"
dependsOn: Build_Release_Artefacts
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')
jobs:
- job: 'Publish_To_GitHub'
displayName: "Publish to GitHub"
steps:
- template: templates/download_artifacts.yml
parameters:
artifact_names:
- aws-watchtower
path: $(Build.ArtifactStagingDirectory)
- task: GitHubRelease@0
displayName: "Create GitHub Release"
inputs:
gitHubConnection: 'lukaspustina-releaseupload'
repositoryName: '$(Build.Repository.Name)'
action: create
target: '$(Build.SourceVersion)'
tagSource: 'auto'
tagPattern: 'v.*'
tag: $(tagName)
assets: $(Build.ArtifactStagingDirectory)/*
assetUploadMode: 'delete'
isDraft: false
isPreRelease: false
addChangeLog: true
compareWith: 'lastFullRelease'
21 changes: 21 additions & 0 deletions .ci/templates/download_artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---

parameters:
artifact_names: []
path: $(Build.ArtifactStagingDirectory)

steps:
- ${{ each artifact in parameters.artifact_names }}:
# Shortcut 'download' cannot be used as it does not restore into the original path; cf. https://docs.microsoft.com/en-us/azure/devops/pipelines/artifacts/pipeline-artifacts?view=azure-devops&tabs=yaml#downloading-artifacts
- task: DownloadPipelineArtifact@2
inputs:
buildType: 'current'
artifactName: Static_Linux_Binary-${{ artifact }}
targetPath: ${{ parameters.path }}
displayName: Download Static Linux Binary ${{ artifact }}
- script: |
cd ${{ parameters.path }}
ls -al
mv -v "${{ artifact }}" "$${{ artifact }}-$AGENT_OSARCHITECTURE-musl-static"
ls -al
displayName: Prepare Assets for Upload ${{ artifact }}

0 comments on commit 63fbe5a

Please sign in to comment.