-
Notifications
You must be signed in to change notification settings - Fork 8
81 lines (69 loc) · 2.46 KB
/
docker.yaml
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: docker
on:
push:
branches:
- 'master'
- 'v*'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.repository }}
uses: actions/checkout@v4
- name: Collect build context
id: context
run: |
echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
echo "version=$(< VERSION)" >> "$GITHUB_OUTPUT"
- name: Get monero tag ref
id: get_release_ref
uses: octokit/request-action@v2.x
with:
route: GET /repos/monero-project/monero/git/refs/tags/${{ steps.context.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get monero commit ref url
id: get_commit_ref_url
run: |
URL="${{ fromJson(steps.get_release_ref.outputs.data).object.url }}"
echo "ref_url=${URL/https:\/\/api.github.com}" >> "$GITHUB_OUTPUT"
- name: Get monero commit ref
id: get_commit_ref
uses: octokit/request-action@v2.x
with:
route: GET ${{ steps.get_commit_ref_url.outputs.ref_url }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata mapping
id: meta
uses: docker/metadata-action@v5
with:
images: |
docker.io/${{ github.repository_owner }}/monero
ghcr.io/${{ github.repository_owner }}/monero
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
type=ref,event=branch,enable=${{ github.ref != 'refs/heads/master' }}
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
build-args: |
MONERO_TAG=${{ steps.context.outputs.version }}