add binary build workflow #7
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: Cross-Platform Build on New Tag | |
on: | |
pull_request: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- os: linux | |
arch: amd64 | |
# Uncomment and add other OS and architecture combinations as needed | |
# - os: linux | |
# arch: arm64 | |
# - os: darwin | |
# arch: amd64 | |
# - os: darwin | |
# arch: arm64 | |
# - os: windows | |
# arch: amd64 | |
# - os: windows | |
# arch: 386 | |
# - os: freebsd | |
# arch: amd64 | |
# - os: freebsd | |
# arch: arm | |
env: | |
BUILDOS: ${{ matrix.os }} | |
BUILDARCH: ${{ matrix.arch }} | |
BINARY_NAME: cryptopower-${{ matrix.os }}-${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Copy instantswap file | |
run: cp ./libwallet/instantswap/instant_example.json ./libwallet/instantswap/instant.json | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
file: ./reproduciblebuilds/Dockerfile | |
load: true | |
platforms: ${{ matrix.os }}/${{ matrix.arch }} | |
push: false | |
tags: user/app:latest | |
build-args: | | |
BUILDOS=${{ env.BUILDOS }} | |
BUILDARCH=${{ env.BUILDARCH }} | |
BUILDNAME=${{ env.BINARY_NAME }} | |
- name: Create Container and Copy Binary | |
run: | | |
docker create --name temp-container user/app:latest | |
docker cp temp-container:/app/${{ env.BINARY_NAME }} ./${{ env.BINARY_NAME }} | |
docker rm temp-container | |
- name: Upload Binary | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ env.BINARY_NAME }} | |
path: ./${{ env.BINARY_NAME }} |