Skip to content

Commit

Permalink
GitHub Actions update
Browse files Browse the repository at this point in the history
Simplifies binaries building and uploading. Removes checkout fetch depth.
  • Loading branch information
Aeron committed Nov 7, 2023
1 parent 3fe8be8 commit 1c5bb24
Showing 1 changed file with 13 additions and 48 deletions.
61 changes: 13 additions & 48 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ name: Publish

on:
release:
types:
- published
# workflow_dispatch:
types: [published]

jobs:
publish-binaries:
name: Publish binaries (${{ matrix.target }})
runs-on: ${{ matrix.os }}
# continue-on-error: true
permissions:
contents: write
env:
Expand Down Expand Up @@ -44,63 +41,32 @@ jobs:
- 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-rust-lang/setup-rust-toolchain@v1
- uses: actions/checkout@v4
- name: Build and Upload
uses: taiki-e/upload-rust-binary-action@v1
with:
toolchain: stable
bin: decoyssh
target: ${{ matrix.target }}
cache: true
- name: Build binary
run: >
cargo build --release --locked --target ${{ matrix.target }}
- 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 }}
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.ref }}
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
- uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
cache: true
- name: Publish
continue-on-error: true
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
Expand All @@ -109,15 +75,14 @@ jobs:
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
# and https://github.com/tonistiigi/binfmt/issues/122
with:
image: tonistiigi/binfmt:qemu-v6.2.0
- name: Build Image
Expand Down Expand Up @@ -150,8 +115,8 @@ jobs:
tags: ${{ steps.build-image.outputs.tags }}
- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v3
continue-on-error: true
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: aeron/decoyssh
continue-on-error: true

0 comments on commit 1c5bb24

Please sign in to comment.