This repository has been archived by the owner on May 7, 2023. It is now read-only.
-
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.
Merge pull request #39 from vincent-herlemont/azure-pipelines
Set up CI with Azure Pipelines
- Loading branch information
Showing
2 changed files
with
102 additions
and
0 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,100 @@ | ||
trigger: none | ||
pr: none | ||
|
||
pool: | ||
vmImage: 'ubuntu-latest' | ||
|
||
jobs: | ||
- job: detect_release | ||
steps: | ||
- bash: | | ||
version=$(curl -s -H "Accept: application/vnd.github.v3+json" \ | ||
"https://api.github.com/repos/vincent-herlemont/short/releases/latest" | \ | ||
jq -r .tag_name | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g') | ||
echo "##vso[task.setvariable variable=version;isOutput=true]$version" | ||
name: github | ||
- bash: | | ||
version=$(cargo metadata --no-deps --format-version 1 --manifest-path Cargo.toml \ | ||
| jq -r '.packages[] | select(.name | test("short")) | .version') | ||
echo "##vso[task.setvariable variable=version;isOutput=true]$version" | ||
name: cargo | ||
- bash: | | ||
echo github_version : {$(github.version)} | ||
echo cargo_version : {$(cargo.version)} | ||
- job: github_release | ||
variables: | ||
cargo_version: $[ dependencies.detect_release.outputs['cargo.version'] ] | ||
dependsOn: detect_release | ||
condition: and(succeeded('detect_release'), ne(dependencies.detect_release.outputs['github.version'], dependencies.detect_release.outputs['cargo.version'])) | ||
steps: | ||
- task: GitHubRelease@1 | ||
inputs: | ||
gitHubConnection: 'github.com_vincent-herlemont' | ||
repositoryName: 'vincent-herlemont/short' | ||
action: 'create' | ||
target: '$(Build.SourceVersion)' | ||
tagSource: 'userSpecifiedTag' | ||
tag: 'v$(cargo_version)' | ||
title: 'v$(cargo_version)' | ||
changeLogCompareToRelease: 'lastFullRelease' | ||
changeLogType: 'commitBased' | ||
|
||
- job: cargo_release | ||
dependsOn: [ github_release ] | ||
condition: succeeded('github_release') | ||
steps: | ||
- bash: | | ||
cargo publish --locked --dry-run | ||
- job: arch_linux_release | ||
variables: | ||
cargo_version: $[ dependencies.detect_release.outputs['cargo.version'] ] | ||
dependsOn: [ detect_release, cargo_release ] | ||
condition: succeeded('cargo_release') | ||
container: vincentherl/archlinux_azure_pipelines:latest | ||
steps: | ||
- task: DownloadSecureFile@1 | ||
name: aurCertificate | ||
inputs: | ||
secureFile: aur | ||
|
||
- bash: | | ||
set -e | ||
cd ~ | ||
mkdir .ssh | ||
sudo cp $(aurCertificate.secureFilePath) .ssh/ | ||
sudo chown vsts_azpcontainer:vsts_azpcontainer .ssh/aur | ||
sudo chmod 600 .ssh/aur | ||
cat <<DOC >> .ssh/config | ||
Host aur.archlinux.org | ||
HostName aur.archlinux.org | ||
User git | ||
AddKeysToAgent yes | ||
IdentityFile ~/.ssh/aur | ||
DOC | ||
echo $(aur_known_hosts_entry) >> .ssh/known_hosts | ||
echo .ssh/known_hosts | ||
cat .ssh/known_hosts | ||
echo .ssh/config | ||
cat .ssh/config | ||
tree -a | ||
ls -al .ssh/ | ||
echo Arch linux release | ||
git clone ssh://aur@aur.archlinux.org/short-git.git | ||
cd short-git | ||
makepkg -do | ||
makepkg --printsrcinfo > .SRCINFO | ||
git config --global user.email "$(git_user_email)" | ||
git config --global user.name "$(git_user_name)" | ||
git add PKGBUILD | ||
git add .SRCINFO | ||
git commit -m "release v$(cargo_version)" | ||
git log -p -1 | ||
git push origin --dry-run |
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