bkapi/.github/workflows/release.yml
2021-12-08 23:31:29 -05:00

78 lines
1.7 KiB
YAML

name: Release
on:
push:
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
release:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Cache target
uses: actions/cache@v2
with:
path: |
target/
key: ${{ runner.os }}-debug-${{ hashFiles('Cargo.lock') }}
- name: Get stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Build binaries
uses: actions-rs/cargo@v1
with:
command: build
args: --release
- name: Move binaries
run: |
mv target/release/bkapi bkapi/bkapi
- name: Upload binaries
uses: actions/upload-artifact@v2
with:
name: bkapi
path: bkapi/bkapi
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ghcr.io/syfaro/bkapi
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
file: bkapi/Dockerfile
sourcegraph:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Generate LSIF data
uses: sourcegraph/lsif-rust-action@main
- name: Upload LSIF data
uses: sourcegraph/lsif-upload-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}