Skip to content

Update CI/CD and swap arg parser #13

Update CI/CD and swap arg parser

Update CI/CD and swap arg parser #13

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy, rustfmt
profile: minimal
- uses: actions/cache@v2
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
- name: get version
id: version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- name: archive
id: archive
run: |
dir="beacon_x86_64-unknown-linux-musl_${{ steps.version.outputs.version }}"
mkdir -p "$dir"
cp README.md "$dir/"
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
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v3
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}