-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (54 loc) · 1.78 KB
/
Copy pathdocker.yml
File metadata and controls
62 lines (54 loc) · 1.78 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
name: Build and push Docker image
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
decred_version:
description: 'Decred version to build (e.g. 2.1.5)'
required: true
default: '2.1.5'
env:
REGISTRY: ghcr.io
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set image name (GHCR requires lowercase)
id: image
run: echo "name=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')/decred" >> $GITHUB_OUTPUT
- name: Set Decred version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ github.event.inputs.decred_version }}" >> $GITHUB_OUTPUT
echo "tag=${{ github.event.inputs.decred_version }}" >> $GITHUB_OUTPUT
else
# Extract version from git tag (v2.1.5 -> 2.1.5)
TAG="${{ github.ref_name }}"
echo "version=${TAG#v}" >> $GITHUB_OUTPUT
echo "tag=${TAG#v}" >> $GITHUB_OUTPUT
fi
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.decred
push: true
build-args: |
DECRED_VERSION=${{ steps.version.outputs.version }}
tags: |
${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:${{ steps.version.outputs.tag }}
${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:latest