Skip to content

Commit

Permalink
Update GA workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
de-luca committed Aug 12, 2023
1 parent ba42e1b commit 600a48c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 55 deletions.
34 changes: 11 additions & 23 deletions .github/workflows/clippy-fmt.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,24 @@
name: Clippy Fmt

on:
push:
branches:
- '*'

jobs:
clippy_fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: clippy, rustfmt
profile: minimal
- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ hashFiles('**/Cargo.toml') }}

- name: cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all

- name: cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: cargo clippy --all
- run: cargo fmt --all -- --check
47 changes: 15 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,35 @@
name: Release

on:
push:
tags:
- '*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
packages: write

steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
override: true
components: clippy, rustfmt
profile: minimal

- uses: actions/cache@v2
components: cross
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ hashFiles('**/Cargo.toml') }}

- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target x86_64-unknown-linux-musl

~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: cross build --release --target x86_64-unknown-linux-musl
- name: get version
id: version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}

- name: archive
id: archive
run: |
Expand All @@ -52,24 +39,20 @@ jobs:
cp target/x86_64-unknown-linux-musl/release/beacon "$dir/"
tar czf "$dir.tar.gz" "$dir"
echo "::set-output name=asset::$dir.tar.gz"
- uses: ncipollo/release-action@v1
with:
artifacts: ${{ steps.archive.outputs.asset }}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/login-action@v1
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v3
- uses: docker/metadata-action@v4
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- uses: docker/build-push-action@v2
- uses: docker/build-push-action@v4
with:
context: .
push: true
Expand Down

0 comments on commit 600a48c

Please sign in to comment.