v4.1.12 #79
Workflow file for this run
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 - Release | |
on: | |
workflow_dispatch: | |
release: | |
types: [published] | |
env: | |
BUILD_VERSION: latest # Computed | |
DOCKER_HUB_USER: defi | |
MAKE_DEBUG: 0 | |
GIT_VERSION: 1 | |
jobs: | |
create-release: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
strategy: | |
matrix: | |
target: [x86_64-pc-linux-gnu, aarch64-linux-gnu, x86_64-w64-mingw32, x86_64-apple-darwin, aarch64-apple-darwin] | |
include: | |
- container: defi/ain-builder:latest | |
- target: x86_64-w64-mingw32 | |
container: defi/ain-win-builder:latest | |
container: | |
image: ${{ matrix.container }} | |
env: | |
TARGET: ${{matrix.target}} | |
steps: | |
- uses: actions/checkout@v4 | |
- run: git config --global --add safe.directory '*' | |
- name: Populate environment | |
run: ./make.sh ci-export-vars | |
- name: Setup dependencies | |
run: ./make.sh ci-setup-deps | |
- name: Setup user dependencies | |
run: ./make.sh ci-setup-user-deps | |
- name: Build and package | |
run: ./make.sh release | |
- name: Publish artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }} | |
path: | | |
./build/defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }} | |
./build/defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }}.SHA256 | |
- name: Get release | |
id: get_release | |
uses: bruceadams/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: ./build/defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }} | |
asset_name: defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }} | |
asset_content_type: application/gzip | |
- name: Upload checksum | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url }} | |
asset_path: ./build/defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }}.SHA256 | |
asset_name: defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }}.SHA256 | |
asset_content_type: text/plain | |
create-docker-release: | |
runs-on: ubuntu-latest | |
needs: [create-release] | |
env: | |
TARGET: x86_64-pc-linux-gnu | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Populate environment | |
run: ./make.sh ci-export-vars | |
- name: Download binaries | |
uses: actions/download-artifact@v3 | |
with: | |
name: defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }} | |
path: ./build/ | |
- name: Unpack binaries | |
run: tar -xvzf ./build/defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }} -C ./build/ | |
- name: Build defi image | |
run: rm .dockerignore && ./make.sh docker-build-from-binaries | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ env.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Push to Docker Hub | |
run: | | |
set -e; ver=${{ env.BUILD_VERSION }} | |
docker tag defichain-${{ env.TARGET }}:${ver} defi/defichain:${ver} | |
docker tag defichain-${{ env.TARGET }}:${ver} defi/defichain:latest | |
docker push defi/defichain:${ver} | |
docker push defi/defichain:latest |