Skip to content

1.0.4

1.0.4 #11

Workflow file for this run

name: Publish
on:
release:
types:
- published
# workflow_dispatch:
jobs:
publish-binaries:
name: Publish binaries (${{ matrix.target }})
runs-on: ${{ matrix.os }}
# continue-on-error: true
permissions:
contents: write
env:
CARGO_INCREMENTAL: 0
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
RUSTUP_MAX_RETRIES: 10
MACOSX_DEPLOYMENT_TARGET: 10.7
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
- target: armv7-unknown-linux-musleabihf
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-freebsd
os: ubuntu-latest
- target: x86_64-unknown-netbsd
os: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set artifact name
shell: bash
run: |
echo "ARTIFACT_NAME=decoyssh-${{ matrix.target }}" >> $GITHUB_ENV
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
target: ${{ matrix.target }}
- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release --locked --target ${{ matrix.target }}
use-cross: ${{ matrix.os == 'ubuntu-latest' }}
- name: Prepare artifacts
run: >
tar -cz
-C target/${{ matrix.target }}/release
-vf ${{ env.ARTIFACT_NAME }}.tgz decoyssh
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: |
*.tgz
- name: Add artifacts
uses: softprops/action-gh-release@v1
with:
files: |
*.tgz
tag_name: ${{ github.ref_name }}
publish-cargo:
name: Publish Cargo package
runs-on: ubuntu-latest
# if: ${{ github.event_name == 'workflow_dispatch' }}
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Publish
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
publish-image:
name: Publish container image
runs-on: ubuntu-latest
# if: ${{ github.event_name == 'workflow_dispatch' }}
permissions:
packages: write
contents: read
env:
GITHUB_REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/decoyssh
DOCKER_REGISTRY_IMAGE: docker.io/aeron/decoyssh
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: recase
uses: ASzc/change-string-case-action@v6
with:
string: ${{ env.GITHUB_REGISTRY_IMAGE }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# HACK: https://github.com/docker/setup-qemu-action/issues/60
with:
image: tonistiigi/binfmt:qemu-v6.2.0
- name: Build Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
tags: >-
${{ steps.recase.outputs.lowercase }}:latest
${{ steps.recase.outputs.lowercase }}:${{ github.ref_name }}
${{ env.DOCKER_REGISTRY_IMAGE }}:latest
${{ env.DOCKER_REGISTRY_IMAGE }}:${{ github.ref_name }}
platforms: linux/amd64, linux/arm64
containerfiles: |
./Dockerfile
- name: Log into GitHub Container Registry
uses: redhat-actions/podman-login@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Log into Docker Hub
uses: redhat-actions/podman-login@v1
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push to registries
uses: redhat-actions/push-to-registry@v2
with:
tags: ${{ steps.build-image.outputs.tags }}
- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: aeron/decoyssh
continue-on-error: true