Build and release #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | | |
sudo 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 }}" |