Skip to content

Build and release

Build and release #12

Workflow file for this run

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 dockerfile.build image
- name: Build and push dockerfile.build
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.build
push: true
tags: |
quainetwork/quai-gpu-miner-build:${{ github.event.inputs.tag_version }}
quainetwork/quai-gpu-miner-build:latest
# Run the container and build the binary using the build image
- name: Run docker container (build)
run: |
docker run --rm -v "${{ github.workspace }}/output:/output" "quainetwork/quai-gpu-miner-build:${{ github.event.inputs.tag_version }}"
- name: Append version number to binary
run: |
sudo mv output/quai-gpu-miner-amd.tar.gz output/quai-gpu-miner-amd-${{ github.event.inputs.tag_version }}.tar.gz
sudo mv output/quai-gpu-miner-nvidia.tar.gz output/quai-gpu-miner-nvidia-${{ 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 Assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create ${{ github.event.inputs.tag_version }} \
output/quai-gpu-miner-amd output/quai-gpu-miner-amd-${{ github.event.inputs.tag_version }}.tar.gz \
output/quai-gpu-miner-nvidia output/quai-gpu-miner-nvidia-${{ github.event.inputs.tag_version }}.tar.gz \
--title "${{ github.event.inputs.tag_version }}"