Skip to content

feat(docker): allow overriding config file for docker image #40

feat(docker): allow overriding config file for docker image

feat(docker): allow overriding config file for docker image #40

Workflow file for this run

name: Release Tag
on:
push:
tags:
- '*'
env:
CARGO_TERM_COLOR: always
jobs:
#?####################################################################################################?#
#? ?#
#? Build Helper Images ?#
#? ?#
#?####################################################################################################?#
aarch64:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building Docker Image
uses: ./.github/actions/build-helper
with:
imagename: aarch64-unknown-linux-gnu
armv7:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building Docker Image
uses: ./.github/actions/build-helper
with:
imagename: armv7-unknown-linux-gnueabihf
x86_64:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building Docker Image
uses: ./.github/actions/build-helper
with:
imagename: x86_64-unknown-linux-gnu
macos_helper:
runs-on: ubuntu-latest
steps:
- run: exit 0
windows_helper:
runs-on: ubuntu-latest
steps:
- run: exit 0
#?####################################################################################################?#
#? ?#
#? Build Releases ?#
#? ?#
#?####################################################################################################?#
Build_aarch64:
needs: [aarch64]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building aarch64 Binary
uses: ./.github/actions/build-linux
with:
target: aarch64-unknown-linux-gnu
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: aarch64-release
path: |
target/aarch64-unknown-linux-gnu/release/witnet
target/aarch64-unknown-linux-gnu/release/witnet_toolkit
Build_armv7:
needs: [armv7]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building armv7 Binary
uses: ./.github/actions/build-linux
with:
target: armv7-unknown-linux-gnueabihf
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: armv7-release
path: |
target/armv7-unknown-linux-gnueabihf/release/witnet
target/armv7-unknown-linux-gnueabihf/release/witnet_toolkit
Build_x86_64:
needs: [x86_64]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Building x86_64 Binary
uses: ./.github/actions/build-linux
with:
target: x86_64-unknown-linux-gnu
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: x86_64-release
path: |
target/x86_64-unknown-linux-gnu/release/witnet
target/x86_64-unknown-linux-gnu/release/witnet_toolkit
Build_macOs:
needs: [macos_helper]
runs-on: macos-12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Protobuf
run: brew install protobuf
- name: Building Macos Binary
run: MACOSX_DEPLOYMENT_TARGET=10.14 OPENSSL_STATIC=1 OPENSSL_DIR="/usr/local/opt/openssl" cargo build --release -p witnet -p witnet_toolkit
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: macos-release
path: |
target/release/witnet
target/release/witnet_toolkit
Build_windows:
needs: [windows_helper]
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Protobuf
run: |
Invoke-WebRequest -Uri https://github.com/protocolbuffers/protobuf/releases/download/v21.1/protoc-21.1-win64.zip -OutFile "protoc.zip"
Expand-Archive -Path protoc.zip -DestinationPath C:\protoc -force
echo "C:\protoc\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# TODO: Needs to be optimized takes wayyyy too long
- name: Install openssl static
run: |
vcpkg.exe install openssl:x64-windows-static
vcpkg.exe integrate install
- name: Build Windows
run: |
Set-Variable -Name "OPENSSL_STATIC" -Value "1"
Set-Variable -Name "OPENSSL_DIR" -Value "C:\Program Files\vcpkg\installed\x64-windows-static"
cargo build --release -p witnet -p witnet_toolkit
- name: Confirm openssl compiled statically
run: LDD.exe target\release\witnet.exe | Select-String -Pattern "ssl"
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: windows-release
path: |
target\release\witnet.exe
target\release\witnet_toolkit.exe
#?####################################################################################################?#
#? ?#
#? Sign & Publish ?#
#? ?#
#?####################################################################################################?#
Sign:
needs: [Build_windows, Build_macOs, Build_x86_64, Build_armv7, Build_aarch64]
runs-on: ubuntu-latest
environment: tags
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Downloading Artifacts
uses: ./.github/actions/download-releases
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v5
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Trust GPG key
run: |
gpg --no-tty --command-fd 0 --edit-key info@witnet.foundation << EOTRUST
trust
5
y
quit
EOTRUST
- name: Sign Hashes
run: |
cd release
gpg --output SHA256SUMS.asc --default-key info@witnet.foundation --detach-sig --clearsign SHA256SUMS && rm SHA256SUMS
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: final-release
path: release/
Release:
needs: [Sign]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download release artifacts
uses: actions/download-artifact@v4
with:
name: final-release
path: release/
- name: Inject Tag
run: |
TAG=${{ github.ref_name }}
sed -i "s/LATEST_VERSION/$TAG/g" RELEASE.md
- name: Check Pre-Release
run: |
TAG=${{ github.ref_name }}
if [[ "$TAG" =~ - ]]; then
echo "prerelease=true" >> $GITHUB_ENV
else
echo "prerelease=false" >> $GITHUB_ENV
fi
- name: Publish Github Release
uses: ncipollo/release-action@v1
with:
name: "Witnet-rust ${{ github.ref_name }}"
artifacts: "./release/*"
bodyFile: "RELEASE.md"
artifactErrorsFailBuild: true
prerelease: ${{ env.prerelease }}
Publish:
needs: [Release]
runs-on: ubuntu-latest
environment: tags
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Docker Container Registry
uses: docker/#-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Base
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name multiarch --driver docker-container --use
docker buildx inspect --bootstrap
# Build Docker images (Latest & TAG)
- name: Build TAG
run: docker buildx build -f docker/witnet-rust/Dockerfile --progress=plain --build-arg WITNET_VERSION=${{github.ref_name}} --platform linux/amd64,linux/arm64,linux/arm/v7 --tag witnet/witnet-rust:${{github.ref_name}} docker/witnet-rust --push --no-cache
- name: Check Pre-release
run: |
TAG=${{ github.ref_name }}
if [[ "$TAG" =~ - ]]; then
echo "prerelease=true" >> $GITHUB_ENV
else
echo "prerelease=false" >> $GITHUB_ENV
fi
- name: Build Latest if not Pre-Release
run: docker buildx build -f docker/witnet-rust/Dockerfile --progress=plain --build-arg WITNET_VERSION=latest --platform linux/amd64,linux/arm64,linux/arm/v7 --tag witnet/witnet-rust:latest docker/witnet-rust --push --no-cache
if: env.prerelease == 'false'