-
Notifications
You must be signed in to change notification settings - Fork 17
64 lines (59 loc) · 1.94 KB
/
push_image_pr.yml
File metadata and controls
64 lines (59 loc) · 1.94 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Push PR image to quay.io
on:
workflow_run:
workflows: ["Build PR image and upload artifact"]
types:
- completed
env:
WF_REGISTRY_USER: netobserv+github_ci
jobs:
push-pr-image:
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
name: push PR image
runs-on: ubuntu-latest
steps:
- name: download artifact
uses: actions/download-artifact@v5
with:
name: pr
run-id: ${{github.event.workflow_run.id }}
github-token: ${{secrets.GITHUB_TOKEN}}
- name: load images
run: |
docker load --input ./image.tar
- name: docker login to quay.io
uses: docker/login-action@v2
with:
username: ${{ env.WF_REGISTRY_USER }}
password: ${{ secrets.QUAY_SECRET }}
registry: quay.io
- name: push images
run: |
DOCKER_BUILDKIT=1 docker push $(cat ./name)
- uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
var fs = require('fs');
var issueNumber = Number(fs.readFileSync('./pr-id'));
var shortSha = String(fs.readFileSync('./short-sha')).trim();
var mainImage = fs.readFileSync('./name');
var commandsURL = fs.readFileSync('./commands-url');
github.rest.issues.createComment({
issue_number: issueNumber,
owner: context.repo.owner,
repo: context.repo.repo,
body: `New image:
\`\`\`bash
${mainImage}
\`\`\`
It will expire in two weeks.
To use this build, update your commands using:
\`\`\`bash
USER=netobserv VERSION=${shortSha} make commands
\`\`\`
or [download the updated commands](${commandsURL}).
`
})