Skip to content

Update GA workflows #14

Update GA workflows

Update GA workflows #14

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: write
packages: write
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
components: cross
- uses: actions/cache@v3
with:
path: |
~/.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: |
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@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v4
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}