Skip to content

ci: update actions #216

ci: update actions

ci: update actions #216

Workflow file for this run

name: cerbes
on:
push:
paths:
- "cerbes/**"
- ".github/workflows/cerbes.yaml"
defaults:
run:
shell: bash
working-directory: cerbes
jobs:
validation:
name: lint & test
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
- run: rustup update stable && rustup default
- run: cargo fmt --all --check
- run: cargo build --verbose
- run: cargo test --verbose
release:
name: release new version
runs-on: ubuntu-latest
needs: validation
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
ref: 'master'
- name: install node
uses: actions/setup-node@v4
with:
node-version: 20
- name: install dependencies
run: sudo npm install -g semantic-release @semantic-release/git @semantic-release/exec
- name: git pull
run: git pull
- name: run semantic release
run: semantic-release
build:
name: build docker image
runs-on: ubuntu-latest
needs: release
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'master'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm/v7,linux/arm64
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: git latest tag
run: |
git fetch --tags --prune --unshallow
tag=$(git describe --tags --abbrev=0 --match 'cerbes-*')
version=$(echo $tag | cut -d'-' -f2 | cut -d'v' -f2)
echo "image_version=${version}" >> $GITHUB_ENV
- name: Build and push
uses: docker/build-push-action@v4
with:
context: cerbes
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
tags: |
yomain/cerbes:${{ env.image_version }}
yomain/cerbes:latest