forked from rocket-pool/old.docs.rocketpool.net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
44 lines (42 loc) · 1.87 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
trigger:
branches:
include:
- '*'
- refs/tags/*
pool:
vmImage: ubuntu-latest
steps:
- task: DownloadSecureFile@1
name: githubPEM
displayName: 'Download Github PEM'
inputs:
secureFile: 'rp-azure-pipeline-github.pem'
- bash: |
eval $(ruby -e "require 'openssl'; require 'jwt'; private_pem = File.read(ENV['GITHUB_PEM_PATH']); private_key = OpenSSL::PKey::RSA.new(private_pem); payload = { iat: Time.now.to_i - 60, exp: Time.now.to_i + (10 * 60), iss: ENV['GITHUB_APP_ID'] }; jwt = JWT.encode(payload, private_key, 'RS256'); puts 'PUSH_JWT='+jwt;")
TOKEN=$(curl -s -X POST \
-H "Authorization: Bearer $PUSH_JWT" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/app/installations/$GITHUB_APP_INSTALLATION_ID/access_tokens \
| jq -r '.token')
git remote add github https://x-access-token:$TOKEN@github.com/rocket-pool/$REPO_NAME
git fetch github
git push github HEAD:$(Build.SourceBranch) --verbose
git push github HEAD:$(Build.SourceBranch) --tags --verbose
displayName: 'Push to Github'
env:
GITHUB_PEM_PATH: $(githubPEM.secureFilePath)
GITHUB_APP_ID: $(GITHUB_APP_ID)
GITHUB_APP_INSTALLATION_ID: $(GITHUB_APP_INSTALLATION_ID)
- bash: |
aws --profile default configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws --profile default configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws ecr get-login-password --region $DOCKER_REPO_REGION | docker login --username AWS --password-stdin $DOCKER_REPO
docker build -t docs.rocketpool.net:latest .
docker tag docs.rocketpool.net:latest $DOCKER_REPO/docs.rocketpool.net:latest
docker push $DOCKER_REPO/docs.rocketpool.net:latest
displayName: "Build"
env:
AWS_ACCESS_KEY_ID: $(AWS_ACCESS_KEY_ID)
AWS_SECRET_ACCESS_KEY: $(AWS_SECRET_ACCESS_KEY)
DOCKER_REPO: $(DOCKER_REPO)
DOCKER_REPO_REGION: $(DOCKER_REPO_REGION)