fix: restoring prod docker image #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build Ratings | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Install build dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libssl-dev pkg-config protobuf-compiler docker-compose | |
- name: Check code formating | |
uses: mbrobbel/rustfmt-check@master | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clippy linting | |
uses: giraffate/clippy-action@v1 | |
with: | |
reporter: "github-pr-review" | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Dependencies security audit | |
uses: actions-rust-lang/audit@v1 | |
with: | |
ignore: RUSTSEC-2023-0071 # patch not available att | |
- name: Setup and Run Tests | |
run: make ci-test | |
publish: | |
if: github.event_name == 'push' | |
name: Publish to ghcr.io | |
needs: build | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install build dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libssl-dev pkg-config protobuf-compiler | |
- name: Setup rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Log in to gchr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata for image labels and tags | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=semver,pattern={{version}} | |
type=sha,format=short | |
- name: Build rock | |
uses: canonical/craft-actions/rockcraft-pack@main | |
id: rockcraft | |
- name: Publish rock to GHCR | |
run: | | |
skopeo --insecure-policy copy oci-archive:${{ steps.rockcraft.outputs.rock }} docker://ghcr.io/${{ steps.meta.outputs.tags }} | |