compile #50
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
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
name: compile | |
jobs: | |
build: | |
name: Build | |
strategy: | |
fail-fast: true | |
matrix: | |
container: | |
- { os: 'ubuntu-latest', rust_target: 'aarch64-unknown-linux-musl' } | |
- { os: 'ubuntu-latest', rust_target: 'x86_64-unknown-linux-musl' } | |
- { os: 'macos-latest', rust_target: 'x86_64-apple-darwin' } | |
- { os: 'macos-latest', rust_target: 'aarch64-apple-darwin' } | |
runs-on: "${{ matrix.container.os }}" | |
steps: | |
- name: Set output | |
id: vars | |
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: "${{ matrix.container.rust_target }}" | |
override: true | |
- uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: "--release --target ${{ matrix.container.rust_target }}" | |
- name: Prepare output artifact (easypwned) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: easypwned-${{ matrix.container.rust_target }} | |
path: | | |
target/${{ matrix.container.rust_target }}/release/easypwned | |
target/${{ matrix.container.rust_target }}/release/easypwned_haveibeenpwned_downloader | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: ["build"] | |
steps: | |
- name: download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: binaries | |
- name: list | |
run: | | |
ls binaries | |
ls binaries/easypwned-${{ matrix.container.rust_target }} | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
files: | | |
binaries/*/target/*/release/* | |
docker_build: | |
name: docker | |
runs-on: ubuntu-latest | |
needs: ["build"] | |
strategy: | |
fail-fast: true | |
matrix: | |
container: | |
- { os: 'ubuntu-latest', arch: 'arm64', rust_target: 'aarch64-unknown-linux-musl' } | |
- { os: 'ubuntu-latest', arch: 'amd64', rust_target: 'x86_64-unknown-linux-musl' } | |
steps: | |
- uses: docker/setup-buildx-action@v1 | |
id: buildx | |
with: | |
install: true | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: easypwned-${{ matrix.container.rust_target }} | |
path: binaries | |
- name: Build and push | |
run: | | |
cp /binaries/easypwned-${{ matrix.container.rust_target }}/target/${{ matrix.container.rust_target }}/release/easypwned binary_easypwned | |
cp /binaries/easypwned-${{ matrix.container.rust_target }}/target/${{ matrix.container.rust_target }}/release/easypwned_haveibeenpwned_downloader binary_easypwned_haveibeenpwned_downloader | |
docker buildx build -o type=docker --platform linux/${{ matrix.container.arch }} -t easybill/easypwned:${{github.ref_name}}_${{ matrix.container.arch }} . | |
docker push easybill/easypwned:${{github.ref_name}}_${{ matrix.container.arch }} | |
docker_manifest: | |
name: Docker Image | |
runs-on: ubuntu-latest | |
needs: ["docker_build"] | |
steps: | |
- name: Build and Push manifest | |
run: | | |
docker manifest create easybill/easypwned:${{ steps.vars.outputs.tag }} easybill/easypwned:${{github.ref_name}}_amd64 easybill/easypwned:${{github.ref_name}}_arm64 | |
docker manifest push easybill/easypwned:${{ steps.vars.outputs.tag }} |