Last active
September 14, 2020 04:17
-
-
Save jonico/185fe4e4e9aac315aae0b43cb998746b to your computer and use it in GitHub Desktop.
Build and push a docker image into GitHub Package registry and create a tag in GitHub using Azure Pipelines (AZP) yaml files (azure-pipelines.yaml)
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
resources: | |
- repo: self | |
trigger: | |
- master | |
steps: | |
- script: ./cleanup.sh | |
displayName: Clean Up | |
- script: docker login -u $(gpr_user) -p $(gpr_pat) docker.pkg.github.com | |
displayName: Logging into GitHub Package Registry | |
- script: docker build -t docker.pkg.github.com/$(Build.Repository.ID)/octocat-generator:$(Build.BuildNumber) . | |
displayName: Building Docker image | |
- script: |- | |
curl -s -H "Authorization: Token $(gpr_pat)" -H "Accept: application/json" -H "Content-type: application/json" -X POST -d "{ \"ref\": \"refs/tags/$(Build.BuildNumber)\", \"sha\": \"$(Build.SourceVersion)\"}" https://api.github.com/repos/$(Build.Repository.ID)/git/refs | |
displayName: Create tag | |
- script: docker push docker.pkg.github.com/$(Build.Repository.ID)/octocat-generator:$(Build.BuildNumber) | |
displayName: Pushing Docker image to GitHub Package Repository | |
- task: Docker@0 | |
displayName: Run Jekyll | |
inputs: | |
action: 'Run an image' | |
imageName: 'jekyll/minimal:3.8.5' | |
volumes: | | |
$(Build.SourcesDirectory):/srv/jekyll | |
$(Build.BinariesDirectory):/srv/jekyll/_site | |
containerCommand: 'jekyll build --future' | |
detached: false | |
- task: ArchiveFiles@1 | |
displayName: Archive Files | |
inputs: | |
includeRootFolder: false | |
- task: PublishBuildArtifacts@1 | |
displayName: Publish Site | |
inputs: | |
PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip' | |
ArtifactName: www |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment