-
Notifications
You must be signed in to change notification settings - Fork 7
91 lines (79 loc) · 3.16 KB
/
build-release.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
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
82
83
84
85
86
87
88
89
90
91
name: Build and release
on:
workflow_dispatch:
inputs:
tag_version:
description: 'Tag version for the release (e.g., v1.0.0)'
required: true
branch:
description: 'Branch to release from (e.g., main, develop)'
default: 'main'
required: true
jobs:
build-and-tag:
name: Build and Tag
runs-on: ubuntu-20.04
steps:
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.GH_PAT }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
echo -e "Host github.com\n IdentityFile ~/.ssh/id_rsa\n StrictHostKeyChecking no" > ~/.ssh/config
chmod 644 ~/.ssh/config
- name: Set Git user configuration
run: |
git config --global user.name "ci-dominantstrategies"
git config --global user.email "[email protected]"
- name: Checkout Repository
uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.GH_PAT }}
fetch-depth: 0
ref: ${{ github.event.inputs.branch }}
- name: Import GPG Key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY2 }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import
git config --global user.signingkey $GPG_KEY_ID
git config --global commit.gpgsign true
git config --global tag.gpgsign true
gpg --list-keys "$GPG_KEY_ID"
# Set up Docker Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Log in to DockerHub (or other registry if needed)
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: quaibuild
password: ${{ secrets.DOCKER }}
# Build and push the Docker image
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: "quainetwork/quai-gpu-miner:${{ github.event.inputs.tag_version }}"
# Run the container and build the binary
- name: Run docker container
run: |
docker run --rm -v "${{ github.workspace }}/output:/output" "quainetwork/quai-gpu-miner:${{ github.event.inputs.tag_version }}"
- name: Append version number to binary
run: |
mv output/quai-gpu-miner.tar.gz output/quai-gpu-miner-${{ github.event.inputs.tag_version }}.tar.gz
- name: Create and Push Signed Tag
env:
TAG_VERSION: ${{ github.event.inputs.tag_version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git tag -s "${{ github.event.inputs.tag_version }}" -m "Release ${{ github.event.inputs.tag_version }}"
git push origin "${{ github.event.inputs.tag_version }}"
- name: Create GitHub Release and Upload Asset
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ github.event.inputs.tag_version }} output/quai-gpu-miner output/quai-gpu-miner-${{ github.event.inputs.tag_version }}.tar.gz --title "${{ github.event.inputs.tag_version }}"